NETFILTER ctnetlink: allow userspace to change protoinfo
Subsystems (2)
PATCH 5/5 NETFILTER ctnetlink: allow userspace to change protoinfo
Hi Dave,
this is clearly a new feature, so it can wait for 2.6.15.
Please apply to your 2.6.15 queue, or tell me to resubmit later, thanks.
[NETFILTER] ctnetlink: add support to change protocol info
This patch add support to change the state of the private protocol information via conntrack_netlink.
Signed-off-by Pablo Neira Ayuso <[email protected]>
Signed-off-by Harald Welte <[email protected]>
---
commit ffcaec22fc809c18ae5c6837515c2ba5962fa0c2
tree b1985400c94eac012415e63d22e9318f22a92f67
parent ba8264034a65ccb9a84e3be2ab1fe5b2b20dc692
author Harald Welte <[email protected]> Fri, 07 Oct 2005 23:42:02 +0200 committer Harald Welte <[email protected]> Fri, 07 Oct 2005 23:42:02 +0200
net/ipv4/netfilter/ip_conntrack_netlink.c | 37 +++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
net/ipv4/netfilter/ip_conntrack_netlink.c +37 -0
@@ -948,6 +948,31 @@ ctnetlink_change_timeout(struct ip_conntreturn 0 ; } +static inline int +ctnetlink_change_protoinfo (struct ip_conntrack *ct,struct nfattr *cda[]) +{ +struct nfattr *tb[CTA_PROTOINFO_MAX ], *attr = cda[CTA_PROTOINFO -1 ]; +struct ip_conntrack_protocol *proto; +u_int16_t npt = ct->tuplehash[IP_CT_DIR_ORIGINAL ].tuple.dst.protonum; +int err =0 ; + +if (nfattr_parse_nested (tb,CTA_PROTOINFO_MAX , attr) <0 ) + goto nfattr_failure; + + proto =ip_conntrack_proto_find_get (npt); +if (!proto) +return -EINVAL ; + +if (proto->from_nfattr) + err = proto->from_nfattr (tb, ct); +ip_conntrack_proto_put (proto); + +return err; + +nfattr_failure: +return -ENOMEM ; +} +static int ctnetlink_change_conntrack (struct ip_conntrack *ct,struct nfattr *cda[]) {
@@ -973,6 +998,12 @@ ctnetlink_change_conntrack(struct ip_conreturn err; } +if (cda[CTA_PROTOINFO -1 ]) { + err =ctnetlink_change_protoinfo (ct, cda); +if (err <0 ) +return err; + } +DEBUGP ("all done\n" );return 0 ; }
@@ -1002,6 +1033,12 @@ ctnetlink_create_conntrack(struct nfattrif (err <0 ) goto err; +if (cda[CTA_PROTOINFO -1 ]) { + err =ctnetlink_change_protoinfo (ct, cda); +if (err <0 ) +return err; + } + ct->helper =ip_conntrack_helper_find_get (rtuple);add_timer (&ct->timeout);
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie