aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nfnetlink_cthelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netfilter/nfnetlink_cthelper.c')
-rw-r--r--net/netfilter/nfnetlink_cthelper.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index d6836193d47..945950a8b1f 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -74,7 +74,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple,
74 if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) 74 if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM])
75 return -EINVAL; 75 return -EINVAL;
76 76
77 tuple->src.l3num = ntohs(nla_get_u16(tb[NFCTH_TUPLE_L3PROTONUM])); 77 tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM]));
78 tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); 78 tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]);
79 79
80 return 0; 80 return 0;
@@ -85,6 +85,9 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
85{ 85{
86 const struct nf_conn_help *help = nfct_help(ct); 86 const struct nf_conn_help *help = nfct_help(ct);
87 87
88 if (attr == NULL)
89 return -EINVAL;
90
88 if (help->helper->data_len == 0) 91 if (help->helper->data_len == 0)
89 return -EINVAL; 92 return -EINVAL;
90 93
@@ -395,16 +398,16 @@ nla_put_failure:
395} 398}
396 399
397static int 400static int
398nfnl_cthelper_fill_info(struct sk_buff *skb, u32 pid, u32 seq, u32 type, 401nfnl_cthelper_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
399 int event, struct nf_conntrack_helper *helper) 402 int event, struct nf_conntrack_helper *helper)
400{ 403{
401 struct nlmsghdr *nlh; 404 struct nlmsghdr *nlh;
402 struct nfgenmsg *nfmsg; 405 struct nfgenmsg *nfmsg;
403 unsigned int flags = pid ? NLM_F_MULTI : 0; 406 unsigned int flags = portid ? NLM_F_MULTI : 0;
404 int status; 407 int status;
405 408
406 event |= NFNL_SUBSYS_CTHELPER << 8; 409 event |= NFNL_SUBSYS_CTHELPER << 8;
407 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*nfmsg), flags); 410 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*nfmsg), flags);
408 if (nlh == NULL) 411 if (nlh == NULL)
409 goto nlmsg_failure; 412 goto nlmsg_failure;
410 413
@@ -468,7 +471,7 @@ restart:
468 cb->args[1] = 0; 471 cb->args[1] = 0;
469 } 472 }
470 if (nfnl_cthelper_fill_info(skb, 473 if (nfnl_cthelper_fill_info(skb,
471 NETLINK_CB(cb->skb).pid, 474 NETLINK_CB(cb->skb).portid,
472 cb->nlh->nlmsg_seq, 475 cb->nlh->nlmsg_seq,
473 NFNL_MSG_TYPE(cb->nlh->nlmsg_type), 476 NFNL_MSG_TYPE(cb->nlh->nlmsg_type),
474 NFNL_MSG_CTHELPER_NEW, cur) < 0) { 477 NFNL_MSG_CTHELPER_NEW, cur) < 0) {
@@ -538,7 +541,7 @@ nfnl_cthelper_get(struct sock *nfnl, struct sk_buff *skb,
538 break; 541 break;
539 } 542 }
540 543
541 ret = nfnl_cthelper_fill_info(skb2, NETLINK_CB(skb).pid, 544 ret = nfnl_cthelper_fill_info(skb2, NETLINK_CB(skb).portid,
542 nlh->nlmsg_seq, 545 nlh->nlmsg_seq,
543 NFNL_MSG_TYPE(nlh->nlmsg_type), 546 NFNL_MSG_TYPE(nlh->nlmsg_type),
544 NFNL_MSG_CTHELPER_NEW, cur); 547 NFNL_MSG_CTHELPER_NEW, cur);
@@ -547,7 +550,7 @@ nfnl_cthelper_get(struct sock *nfnl, struct sk_buff *skb,
547 break; 550 break;
548 } 551 }
549 552
550 ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).pid, 553 ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,
551 MSG_DONTWAIT); 554 MSG_DONTWAIT);
552 if (ret > 0) 555 if (ret > 0)
553 ret = 0; 556 ret = 0;