Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7547163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:23:00+00:00 2026-05-30T09:23:00+00:00

Basically, I want to write a kernel module that adds a possible filter to

  • 0

Basically, I want to write a kernel module that adds a possible filter to ebtables. Then I need to tell ebtables to use my filter on a bridge I have set up.

The reason I need to write my own module is that I want to introduce delay between consecutive packages (for some testing reason). To demonstrate, my network originally has a traffic like this:

+++-----------------+++-----------------+++-----------------+++-----------------

where + shows traffic of a package and - means no package on the line. I want to put a bridge in between so that the pattern of the packets would change to this:

+----+----+---------+----+----+---------+----+----+---------+----+----+---------

This means that I would make sure there would be a certain amount of delay between arrival of each packet.

Now I have written the following simple code which I basically took from linux-source/net/bridge/netfilter/ebt_ip.c:

static bool match(const struct sk_buff *skb, const struct xt_match_param *par)
{
    printk(KERN_INFO"match called\n");
    return true;  // match everything!
}

static bool check(const struct xt_mtchk_param *par)
{
    printk(KERN_INFO"check called\n");
    return true;  // pass everything!
}

static struct xt_match reg __read_mostly = {
    .name = "any",   // I made this up, but I tried also putting ip for example which didn't change anything.
    .revision = 0,
    .family = NFPROTO_BRIDGE,
    .match = match,
    .checkentry = check,
    .matchsize = XT_ALIGN(4),  // don't know what this is, so I just gave it an `int`
    .me = THIS_MODULE
};

int init_module(void)
{
    return xt_register_match(&reg);
}

void cleanup_module(void)
{
    xt_unregister_match(&reg);
}

I successfully load the module. But it’s as if it’s not there. I’m not getting the logs inside match and check functions so the bridge is clearly not considering my filter. What am I doing wrong?

I have tried many combinations of loading my filter first, setting up the bridge first or setting ebtables rules first, but none of them change anything.

P.S. The bridge itself works. I am certain that ebtables is also in effect because if I add a policy to drop packages, I don’t receive them on the final computer. What I can’t figure out is how to tell ebtables to consider my filter also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:23:01+00:00Added an answer on May 30, 2026 at 9:23 am

    To use a kernel module, you also need to write an appropriate plugin for the userspace program, and afterwards, insert a rule invoking it.

    If you do not have any options, do not specify any .matchsize parameter in struct xt_match (equal to specifying 0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a simple SMPP Server that basically forwards traffic to another
Basically I want to write php code that lists all the contents that are
I have a input that you enter a URL, i basically want to write
So basically I want to write a function that can be written like this:
I want to write a python script (Yes not Bash) that will use flac
I want to write a rule in prolog, which basically says If a user
I'm trying to write my first iterator class / container type. Basically, I want
I basically want to use link_to to link to the index method of a
I want to write a Mysql statement that selects all from a table(posting) where
I starting to write an application that will need to have a QR code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.