* [PATCH 7/7] Implements change protoinfo via from_nfattr
@ 2005-08-01 17:07 Pablo Neira
0 siblings, 0 replies; only message in thread
From: Pablo Neira @ 2005-08-01 17:07 UTC (permalink / raw)
To: Netfilter Development Mailinglist; +Cc: Harald Welte
[-- Attachment #1: Type: text/plain, Size: 53 bytes --]
Add a function to parse private protocol attributes.
[-- Attachment #2: 07from-nfattr.patch --]
[-- Type: text/x-patch, Size: 1701 bytes --]
Index: netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
===================================================================
--- netfilter-2.6.14.orig/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2005-08-01 18:20:57.000000000 +0200
+++ netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2005-08-01 18:21:26.000000000 +0200
@@ -351,6 +351,17 @@
nfattr_failure:
return -1;
}
+
+static int nfattr_to_tcp(struct nfattr *tb[], struct ip_conntrack *ct)
+{
+ if (!tb[CTA_PROTOINFO_TCP_STATE-1])
+ return -EINVAL;
+
+ ct->proto.tcp.state =
+ *(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_TCP_STATE-1]);
+
+ return 0;
+}
#endif
static unsigned int get_conntrack_index(const struct tcphdr *tcph)
@@ -1121,6 +1132,7 @@
#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)
.to_nfattr = tcp_to_nfattr,
+ .from_nfattr = nfattr_to_tcp,
.tuple_to_nfattr = ip_ct_port_tuple_to_nfattr,
.nfattr_to_tuple = ip_ct_port_nfattr_to_tuple,
#endif
Index: netfilter-2.6.14/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
===================================================================
--- netfilter-2.6.14.orig/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2005-08-01 18:20:57.000000000 +0200
+++ netfilter-2.6.14/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2005-08-01 18:21:26.000000000 +0200
@@ -52,6 +52,8 @@
int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
const struct ip_conntrack *ct);
+ int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
+
int (*tuple_to_nfattr)(struct sk_buff *skb,
const struct ip_conntrack_tuple *t);
int (*nfattr_to_tuple)(struct nfattr *tb[],
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-01 17:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-01 17:07 [PATCH 7/7] Implements change protoinfo via from_nfattr Pablo Neira
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.