extern void nl_cli_exp_parse_family(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_timeout(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_id(struct nfnl_exp *, char *);
+extern void nl_cli_exp_parse_helper_name(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_src(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_dst(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_l4protonum(struct nfnl_exp *, int, char *);
#define NFNLMSG_EXP_TYPE(type) NFNLMSG_TYPE(NFNL_SUBSYS_CTNETLINK_EXP, (type))
static struct nl_cache_ops nfnl_exp_ops = {
- .co_name = "netfilter/exp",
- .co_hdrsize = NFNL_HDRLEN,
+ .co_name = "netfilter/exp",
+ .co_hdrsize = NFNL_HDRLEN,
.co_msgtypes = {
{ NFNLMSG_EXP_TYPE(IPCTNL_MSG_EXP_NEW), NL_ACT_NEW, "new" },
{ NFNLMSG_EXP_TYPE(IPCTNL_MSG_EXP_GET), NL_ACT_GET, "get" },
END_OF_MSGTYPES_LIST,
},
.co_protocol = NETLINK_NETFILTER,
- .co_groups = exp_groups,
+ .co_groups = exp_groups,
.co_request_update = exp_request_update,
.co_msg_parser = exp_msg_parser,
- .co_obj_ops = &exp_obj_ops,
+ .co_obj_ops = &exp_obj_ops,
};
static void __init exp_init(void)
#define EXP_ATTR_NAT_L4PROTO_NUM (1UL << 25) // contains l4proto # + PORT attrs or ICMP attrs
#define EXP_ATTR_NAT_L4PROTO_PORTS (1UL << 26)
#define EXP_ATTR_NAT_L4PROTO_ICMP (1UL << 27)
-
#define EXP_ATTR_NAT_DIR (1UL << 28) // 8-bit
/** @endcond */
static void exp_dump_tuples(struct nfnl_exp *exp, struct nl_dump_params *p)
{
- struct nl_addr *tuple_src = NULL, *tuple_dst = NULL;
+ struct nl_addr *tuple_src, *tuple_dst;
int tuple_sport = 0, tuple_dport = 0;
int i = 0;
char buf[64];
for (i = NFNL_EXP_TUPLE_EXPECT; i <= NFNL_EXP_TUPLE_NAT; i++) {
+ tuple_src = NULL;
+ tuple_dst = NULL;
- // Test needed for NAT case
+ // Test needed for NAT case
if (nfnl_exp_test_src(exp, i))
tuple_src = nfnl_exp_get_src(exp, i);
if (nfnl_exp_test_dst(exp, i))
tuple_sport = nfnl_exp_get_src_port(exp, i);
tuple_dport = nfnl_exp_get_dst_port(exp, i);
}
+
dump_addr(p, tuple_src, tuple_sport);
dump_addr(p, tuple_dst, tuple_dport);
dump_icmp(p, exp, 0);
#define EXP_GET_TUPLE(e, t) \
(t == NFNL_EXP_TUPLE_MASTER) ? \
&(e->exp_master) : \
- (t == NFNL_EXP_TUPLE_MASK) ?\
+ (t == NFNL_EXP_TUPLE_MASK) ? \
&(e->exp_mask) : \
- (t == NFNL_EXP_TUPLE_NAT) ?\
+ (t == NFNL_EXP_TUPLE_NAT) ? \
&(e->exp_nat) : &(exp->exp_expect)
static int exp_get_src_attr(int tuple)
nfnl_exp_set_id(exp, id);
}
+void nl_cli_exp_parse_helper_name(struct nfnl_exp *exp, char *arg)
+{
+ int err;
+ nfnl_exp_set_helper_name(exp, arg);
+}
+
void nl_cli_exp_parse_src(struct nfnl_exp *exp, int tuple, char *arg)
{
int err;
" --master-dport=PORT Master conntrack destination port\n"
" -F, --family=FAMILY Address family\n"
" --timeout=NUM Timeout value\n"
+ " --helper=STRING Helper Name\n"
//" --flags Flags\n"
);
exit(0);
ARG_MASTER_DST,
ARG_MASTER_DPORT,
ARG_TIMEOUT,
+ ARG_HELPER_NAME,
//ARG_FLAGS,
};
static struct option long_opts[] = {
{ "master-dport", 1, 0, ARG_MASTER_DPORT },
{ "family", 1, 0, 'F' },
{ "timeout", 1, 0, ARG_TIMEOUT },
+ { "helper", 1, 0, ARG_HELPER_NAME },
//{ "flags", 1, 0, ARG_FLAGS},
{ 0, 0, 0, 0 }
};
case ARG_MASTER_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break;
case 'F': nl_cli_exp_parse_family(exp, optarg); break;
case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break;
+ case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break;
//case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break;
}
}