From 34a4c4da11dda9867ca6d11a184d9f17933f6b72 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 7 Oct 2013 15:06:00 +0200 Subject: expect: add cthelper_get_port_src and cthelper_get_port_port --- expect.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'expect.c') diff --git a/expect.c b/expect.c index 072e913..3d59f9e 100644 --- a/expect.c +++ b/expect.c @@ -241,6 +241,30 @@ int cthelper_cmp_addr_dst(struct nf_conntrack *ct, int dir, return memcmp(addr, &tmp, sizeof(union nfct_attr_grp_addr)) == 0; } +void cthelper_get_port_src(struct nf_conntrack *ct, int dir, uint16_t *port) +{ + switch (dir) { + case MYCT_DIR_ORIG: + *port = nfct_get_attr_u16(ct, ATTR_PORT_SRC); + break; + case MYCT_DIR_REPL: + *port = nfct_get_attr_u16(ct, ATTR_REPL_PORT_SRC); + break; + } +} + +void cthelper_get_port_dst(struct nf_conntrack *ct, int dir, uint16_t *port) +{ + switch (dir) { + case MYCT_DIR_ORIG: + *port = nfct_get_attr_u16(ct, ATTR_PORT_DST); + break; + case MYCT_DIR_REPL: + *port = nfct_get_attr_u16(ct, ATTR_REPL_PORT_DST); + break; + } +} + int cthelper_cmp_exp_addr_dst(struct nf_expect *exp, union nfct_attr_grp_addr *addr) { -- cgit v1.2.3