| --- a/include/internal/object.h 2015-05-27 03:27:34.102294894 -0700 |
| +++ b/include/internal/object.h 2015-10-28 13:01:38.315308063 -0700 |
| @@ -153,6 +153,12 @@ |
| uint32_t set[__NFCT_BITSET]; |
| }; |
| |
| +struct __nfct_comcerto_fp_info { |
| + int ifindex; |
| + int iif; |
| + uint32_t mark; |
| +}; |
| + |
| struct nf_conntrack { |
| struct nfct_tuple_head head; |
| struct __nfct_tuple repl; |
| @@ -161,6 +167,7 @@ |
| uint32_t timeout; |
| uint32_t mark; |
| uint32_t secmark; |
| + struct __nfct_comcerto_fp_info fp_info[__DIR_MAX]; |
| uint32_t status; |
| uint32_t use; |
| uint32_t id; |
| |
| --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h 2015-10-28 12:16:54.927728157 -0700 |
| +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h 2015-10-28 13:03:47.498110493 -0700 |
| @@ -136,6 +136,12 @@ |
| ATTR_HELPER_INFO, /* variable length */ |
| ATTR_CONNLABELS, /* variable length */ |
| ATTR_CONNLABELS_MASK, /* variable length */ |
| + ATTR_ORIG_COMCERTO_FP_IIF, |
| + ATTR_ORIG_COMCERTO_FP_IFINDEX, |
| + ATTR_ORIG_COMCERTO_FP_MARK, |
| + ATTR_REPL_COMCERTO_FP_IIF, |
| + ATTR_REPL_COMCERTO_FP_IFINDEX, |
| + ATTR_REPL_COMCERTO_FP_MARK, |
| ATTR_MAX |
| }; |
| |
| --- a/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h 2015-05-27 03:25:48.066296086 -0700 |
| +++ b/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h 2015-10-28 13:06:10.884777061 -0700 |
| @@ -57,6 +57,8 @@ |
| CTA_MARK_MASK, |
| CTA_LABELS, |
| CTA_LABELS_MASK, |
| + CTA_COMCERTO_FP_ORIG = 32, |
| + CTA_COMCERTO_FP_REPLY, |
| __CTA_MAX |
| }; |
| #define CTA_MAX (__CTA_MAX - 1) |
| @@ -222,6 +224,15 @@ |
| }; |
| #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) |
| |
| +enum ctattr_comcerto_fp { |
| + CTA_COMCERTO_FP_UNSPEC, |
| + CTA_COMCERTO_FP_MARK, |
| + CTA_COMCERTO_FP_IFINDEX, |
| + CTA_COMCERTO_FP_IIF, |
| + __CTA_COMCERTO_FP_MAX |
| +}; |
| +#define CTA_COMCERTO_FP_MAX (__CTA_COMCERTO_FP_MAX - 1) |
| + |
| enum ctattr_secctx { |
| CTA_SECCTX_UNSPEC, |
| CTA_SECCTX_NAME, |
| |
| --- a/src/conntrack/getter.c 2015-05-27 03:23:01.782297954 -0700 |
| +++ b/src/conntrack/getter.c 2015-10-28 13:10:43.782229021 -0700 |
| @@ -349,6 +349,36 @@ |
| return ct->connlabels_mask; |
| } |
| |
| +static const void *get_attr_orig_comcerto_fp_iif(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_ORIG].iif; |
| +} |
| + |
| +static const void *get_attr_orig_comcerto_fp_ifindex(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_ORIG].ifindex; |
| +} |
| + |
| +static const void *get_attr_orig_comcerto_fp_mark(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_ORIG].mark; |
| +} |
| + |
| +static const void *get_attr_repl_comcerto_fp_iif(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_REPL].iif; |
| +} |
| + |
| +static const void *get_attr_repl_comcerto_fp_ifindex(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_REPL].ifindex; |
| +} |
| + |
| +static const void *get_attr_repl_comcerto_fp_mark(const struct nf_conntrack *ct) |
| +{ |
| + return &ct->fp_info[__DIR_REPL].mark; |
| +} |
| + |
| const get_attr get_attr_array[ATTR_MAX] = { |
| [ATTR_ORIG_IPV4_SRC] = get_attr_orig_ipv4_src, |
| [ATTR_ORIG_IPV4_DST] = get_attr_orig_ipv4_dst, |
| @@ -418,4 +448,10 @@ |
| [ATTR_HELPER_INFO] = get_attr_helper_info, |
| [ATTR_CONNLABELS] = get_attr_connlabels, |
| [ATTR_CONNLABELS_MASK] = get_attr_connlabels_mask, |
| + [ATTR_ORIG_COMCERTO_FP_IIF] = get_attr_orig_comcerto_fp_iif, |
| + [ATTR_ORIG_COMCERTO_FP_IFINDEX] = get_attr_orig_comcerto_fp_ifindex, |
| + [ATTR_ORIG_COMCERTO_FP_MARK] = get_attr_orig_comcerto_fp_mark, |
| + [ATTR_REPL_COMCERTO_FP_IIF] = get_attr_repl_comcerto_fp_iif, |
| + [ATTR_REPL_COMCERTO_FP_IFINDEX] = get_attr_repl_comcerto_fp_ifindex, |
| + [ATTR_REPL_COMCERTO_FP_MARK] = get_attr_repl_comcerto_fp_mark, |
| }; |
| |
| --- a/src/conntrack/parse.c 2015-05-27 03:27:34.114294894 -0700 |
| +++ b/src/conntrack/parse.c 2015-10-28 13:21:18.412256588 -0700 |
| @@ -493,6 +493,50 @@ |
| } |
| } |
| |
| +static void |
| +__parse_comcerto_fp(const struct nfattr *attr, struct nf_conntrack *ct, int dir) |
| +{ |
| + struct nfattr *tb[CTA_COMCERTO_FP_MAX]; |
| + |
| + nfnl_parse_nested(tb, CTA_COMCERTO_FP_MAX, attr); |
| + |
| + if (tb[CTA_COMCERTO_FP_IIF-1]) { |
| + ct->fp_info[dir].iif = *(uint32_t *)NFA_DATA(tb[CTA_COMCERTO_FP_IIF-1]); |
| + switch(dir) { |
| + case __DIR_ORIG: |
| + set_bit(ATTR_ORIG_COMCERTO_FP_IIF, ct->head.set); |
| + break; |
| + case __DIR_REPL: |
| + set_bit(ATTR_REPL_COMCERTO_FP_IIF, ct->head.set); |
| + break; |
| + } |
| + } |
| + |
| + if (tb[CTA_COMCERTO_FP_IFINDEX-1]) { |
| + ct->fp_info[dir].ifindex = *(uint32_t *)NFA_DATA(tb[CTA_COMCERTO_FP_IFINDEX-1]); |
| + switch(dir) { |
| + case __DIR_ORIG: |
| + set_bit(ATTR_ORIG_COMCERTO_FP_IFINDEX, ct->head.set); |
| + break; |
| + case __DIR_REPL: |
| + set_bit(ATTR_REPL_COMCERTO_FP_IFINDEX, ct->head.set); |
| + break; |
| + } |
| + } |
| + |
| + if (tb[CTA_COMCERTO_FP_MARK-1]) { |
| + ct->fp_info[dir].mark = *(uint32_t *)NFA_DATA(tb[CTA_COMCERTO_FP_MARK-1]); |
| + switch(dir) { |
| + case __DIR_ORIG: |
| + set_bit(ATTR_ORIG_COMCERTO_FP_MARK, ct->head.set); |
| + break; |
| + case __DIR_REPL: |
| + set_bit(ATTR_REPL_COMCERTO_FP_MARK, ct->head.set); |
| + break; |
| + } |
| + } |
| +} |
| + |
| void __parse_conntrack(const struct nlmsghdr *nlh, |
| struct nfattr *cda[], |
| struct nf_conntrack *ct) |
| @@ -552,6 +596,12 @@ |
| set_bit(ATTR_SECMARK, ct->head.set); |
| } |
| |
| + if (cda[CTA_COMCERTO_FP_ORIG-1]) |
| + __parse_comcerto_fp(cda[CTA_COMCERTO_FP_ORIG-1], ct, __DIR_ORIG); |
| + |
| + if (cda[CTA_COMCERTO_FP_REPLY-1]) |
| + __parse_comcerto_fp(cda[CTA_COMCERTO_FP_REPLY-1], ct, __DIR_REPL); |
| + |
| if (cda[CTA_COUNTERS_ORIG-1]) |
| __parse_counters(cda[CTA_COUNTERS_ORIG-1], ct, __DIR_ORIG); |
| |