From: Ozgur AKAN <akan@aiqa.com>
To: netfilter-devel@lists.netfilter.org
Subject: Re: mask for interface
Date: Thu, 25 Mar 2004 14:09:48 +0200 [thread overview]
Message-ID: <4062CC0C.3080503@aiqa.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0403251241430.14618-100000@filer.marasystems.com>
...to test mask value of the input interface I wrote a small program
(below) and insert these rules..
iptables -N test
iptables -A test -i eth0 -p tcp -s 10.0.0.1 -d 10.1.1.1 -j ACCEPT
iptables -A test -i eth+ -p tcp -s 10.0.0.1 -d 10.1.1.1 -j ACCEPT
-----------------------------------begin---------sample code to test
interface mask-----------------------------
#include <stdio.h>
#include <sys/errno.h>
#include "iptables.h"
#include "libiptc/libiptc.h"
#include <stdlib.h>
int main(void)
{
iptc_handle_t h;
const struct ipt_entry *e;
const char *chain = NULL;
const char *tablename = "filter";
h = iptc_init(tablename);
if ( !h ) {
printf("Problem when initializing: %s\n", iptc_strerror(errno));
exit(errno);
}
for ( chain = iptc_first_chain(&h); chain; chain =
iptc_next_chain(&h)) {
printf("%s\n", chain);
for ( e = iptc_first_rule(chain, &h); e; e = iptc_next_rule(e,
&h)) {
printf("iface : %s, mask : %s \n", e->ip.iniface,
e->ip.iniface_mask);
}
}
exit(0);
}
-----------------------------------end---------sample code to test
interface mask-----------------------------
the output is same for eth+ and eth0
-----------------------------------begin---------output of the
test-----------------------------
iface : eth0, mask :
iface : eth+, mask :
-----------------------------------end---------output of the
test-------------------------------
Is there another way to create a mask for an interface?
What am I doing wrong to test iniface_mask?
thanks,
Ozgur AKAN
next prev parent reply other threads:[~2004-03-25 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-25 8:56 mask for interface Ozgur AKAN
2004-03-25 11:46 ` Henrik Nordstrom
2004-03-25 12:09 ` Ozgur AKAN [this message]
2004-03-26 14:40 ` Ozgur AKAN
2004-03-27 0:56 ` Henrik Nordstrom
2004-03-30 8:32 ` Ozgur AKAN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4062CC0C.3080503@aiqa.com \
--to=akan@aiqa.com \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.