Skip to contentSkip to conversation

conntrackd: cthelper: add DHCPv6 support

PATCH New [email protected] 1 participant 1 message Feb 26, 2013 netfilter

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 conntrackd: cthelper: add DHCPv6 support

From: Pablo Neira Ayuso <[email protected]>

This patch adds the DHCPv6 helper.

---
 include/helper.h        |    2 +
 src/expect.c            |   20 +++++++++
 src/helpers/Makefile.am |    7 +++-
 src/helpers/dhcpv6.c    |  104 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+), 1 deletion(-)
 create mode 100644 src/helpers/dhcpv6.c
include/helper.h +2 -0
index 9d96fb7..c9cb4a6 100644
@@ -46,6 +46,8 @@ extern int cthelper_expect_init(struct nf_expect *exp, struct nf_conntrack *mast
 extern int cthelper_add_expect(struct nf_expect *exp);
 extern int cthelper_del_expect(struct nf_expect *exp);
 
+extern int cthelper_update_ct(struct nf_conntrack *ct);
+
 extern void cthelper_get_addr_src(struct nf_conntrack *ct, int dir, union nfct_attr_grp_addr *addr);
 extern void cthelper_get_addr_dst(struct nf_conntrack *ct, int dir, union nfct_attr_grp_addr *addr);
 
src/expect.c +20 -0
index 6069770..552facb 100644
@@ -175,6 +175,26 @@ static int cthelper_expect_cmd(struct nf_expect *exp, int cmd)
 	return ret;
 }
 
+static int cthelper_ct_cmd(struct nf_conntrack *ct, int cmd)
+{
+	int ret;
+	struct nfct_handle *h;
+
+	h = nfct_open(CONNTRACK, 0);
+	if (!h)
+		return -1;
+
+	ret = nfct_query(h, cmd, ct);
+
+	nfct_close(h);
+	return ret;
+}
+
+int cthelper_update_ct(struct nf_conntrack *ct)
+{
+	return cthelper_ct_cmd(ct, NFCT_Q_UPDATE);
+}
+
 int cthelper_add_expect(struct nf_expect *exp)
 {
 	return cthelper_expect_cmd(exp, NFCT_Q_CREATE_UPDATE);
src/helpers/Makefile.am +6 -1
index 589b4f3..e254111 100644
@@ -2,7 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 pkglib_LTLIBRARIES = ct_helper_ftp.la	\
 		     ct_helper_rpc.la	\
-		     ct_helper_tns.la
+		     ct_helper_tns.la	\
+		     ct_helper_dhcpv6.la
 
 ct_helper_ftp_la_SOURCES = ftp.c
 ct_helper_ftp_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
@@ -15,3 +16,7 @@ ct_helper_rpc_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_CONNTRACK_CFLAGS)
 ct_helper_tns_la_SOURCES = tns.c
 ct_helper_tns_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
 ct_helper_tns_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_CONNTRACK_CFLAGS)
+
+ct_helper_dhcpv6_la_SOURCES = dhcpv6.c
+ct_helper_dhcpv6_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
+ct_helper_dhcpv6_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_CONNTRACK_CFLAGS)
src/helpers/dhcpv6.c new file +104 -0

104 lines not on this page · raw message

Signature · 1 line
1.7.10.4