target, match and checkentry functions
Hi,
I am reading ip_tables.h. There is a structure called ipt_target. In it there is pointer to a function which is below.
unsigned int (*target <http://lxr.linux.no/ident?i=target>)(struct sk_buff <http://lxr.linux.no/ident?i=sk_buff> **pskb, .......)
I can not find the original function that this function pointer(*target) points. When I search for target, I see that it is defined in 6 files. Which one is used and when? How can I understand it? (this is same for match and checkentry functions)
6 files in which target is defined;
* net/ipv4/netfilter/ipt_ECN.c, line 104
<http://lxr.linux.no/source/net/ipv4/netfilter/ipt_ECN.c#L104> * net/ipv4/netfilter/ipt_DSCP.c, line 25 <http://lxr.linux.no/source/net/ipv4/netfilter/ipt_DSCP.c#L25> * net/ipv4/netfilter/ipt_MARK.c, line 11 <http://lxr.linux.no/source/net/ipv4/netfilter/ipt_MARK.c#L11> * net/ipv4/netfilter/ipt_TOS.c, line 11 <http://lxr.linux.no/source/net/ipv4/netfilter/ipt_TOS.c#L11> * net/ipv6/netfilter/ip6t_MARK.c, line 11 <http://lxr.linux.no/source/net/ipv6/netfilter/ip6t_MARK.c#L11>
thanks,
Signature · 1 line
Ozgur Akan
....also I can not find where LABEL_ACCEPT is defined. I grep`ed all kernel and iptables source but could not find! ( It is used in libiptc.c )
thanks to anyone who replies,
Signature · 1 line
Ozgur Akan
Quoted 4 lines
....also I can not find where
LABEL_ACCEPTis defined. I grep`ed all kernel and iptables source but could not find! ( It is used inlibiptc.c)thanks to anyone who replies,
libipt4tc.c defines LABEL_ACCEPT as IPTC_LABEL_ACCEPT if I'm not mistaken. IPTC_LABEL_ACCEPT is defined in libiptc.h
Thomas
Quoted 8 lines
libipt4tc.cdefinesLABEL_ACCEPTasIPTC_LABEL_ACCEPTif I'm not mistaken.IPTC_LABEL_ACCEPTis defined inlibiptc.hThomas
yes you are completely right!
IPTC_LABEL_ACCEPT is defined as "ACCEPT". That was what I was looking for.
(my brain does not work well when glucose level decreses :) )
thanks,
Signature · 1 line
Ozgur Akan
Quoted 10 lines · Ozgur AKAN
Hi,
I am reading
ip_tables.h. There is a structure calledipt_target. In it there is pointer to a function which is below.unsigned int (*target)(struct
sk_buff**pskb, .......)I can not find the original function that this function
pointer(*target)points. When I search for target, I see that it is defined in 6 files. Which one is used and when?
You can not find the original "target" function as there is none. It is all dependent on which iptables target you are looking at.
This pointer is a pointer to the target function of the target defined by this ipt_target structure instance. Each target has it's own ipt_target instance with it's unique function pointer in the target field of ipt_target.
Quoted 2 lines
How can I understand it? (this is same for match and checkentry functions)
Same thing but for matches.
both targets and matches have checkentry functions.
Quoted 12 lines
6 files in which target is defined;
*
net/ipv4/netfilter/ipt_ECN.c, line 104
<http://lxr.linux.no/source/net/ipv4/netfilter/ipt_ECN.c#L104>
*net/ipv4/netfilter/ipt_DSCP.c, line 25
<http://lxr.linux.no/source/net/ipv4/netfilter/ipt_DSCP.c#L25>
*net/ipv4/netfilter/ipt_MARK.c, line 11
<http://lxr.linux.no/source/net/ipv4/netfilter/ipt_MARK.c#L11>
*net/ipv4/netfilter/ipt_TOS.c, line 11
<http://lxr.linux.no/source/net/ipv4/netfilter/ipt_TOS.c#L11>
*net/ipv6/netfilter/ip6t_MARK.c, line 11
<http://lxr.linux.no/source/net/ipv6/netfilter/ip6t_MARK.c#L11>
Actually it is defined in a whole lot more files. Each ip(6)t_[capital_letters].c defines a ipt_target instance with a unique target function.
Each ip(6)t_[lowercase_letters].c defines a ipt_match instance with a unique match function.
There is very many of them.
Regards
Henrik