[NETFILTER]: nfnetlink: convert to generic netlink attribute functions
[deliverable/linux.git] / net / ipv4 / netfilter / nf_conntrack_l3proto_ipv4.c
index d9b5177989c65b14f02b25ace7493f18c2090132..f8771e058b9e15bd31477d9d96399cbf823bb8fd 100644 (file)
@@ -87,14 +87,10 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
        if (iph == NULL)
                return -NF_DROP;
 
-       /* Never happen */
-       if (iph->frag_off & htons(IP_OFFSET)) {
-               if (net_ratelimit()) {
-                       printk(KERN_ERR "ipv4_get_l4proto: Frag of proto %u\n",
-                       iph->protocol);
-               }
+       /* Conntrack defragments packets, we might still see fragments
+        * inside ICMP packets though. */
+       if (iph->frag_off & htons(IP_OFFSET))
                return -NF_DROP;
-       }
 
        *dataoff = nhoff + (iph->ihl << 2);
        *protonum = iph->protocol;
@@ -367,32 +363,32 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
 static int ipv4_tuple_to_nfattr(struct sk_buff *skb,
                                const struct nf_conntrack_tuple *tuple)
 {
-       NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t),
+       NLA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t),
                &tuple->src.u3.ip);
-       NFA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t),
+       NLA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t),
                &tuple->dst.u3.ip);
        return 0;
 
-nfattr_failure:
+nla_put_failure:
        return -1;
 }
 
-static const size_t cta_min_ip[CTA_IP_MAX] = {
-       [CTA_IP_V4_SRC-1]       = sizeof(u_int32_t),
-       [CTA_IP_V4_DST-1]       = sizeof(u_int32_t),
+static const size_t cta_min_ip[CTA_IP_MAX+1] = {
+       [CTA_IP_V4_SRC] = sizeof(u_int32_t),
+       [CTA_IP_V4_DST] = sizeof(u_int32_t),
 };
 
-static int ipv4_nfattr_to_tuple(struct nfattr *tb[],
+static int ipv4_nfattr_to_tuple(struct nlattr *tb[],
                                struct nf_conntrack_tuple *t)
 {
-       if (!tb[CTA_IP_V4_SRC-1] || !tb[CTA_IP_V4_DST-1])
+       if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST])
                return -EINVAL;
 
        if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
                return -EINVAL;
 
-       t->src.u3.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
-       t->dst.u3.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
+       t->src.u3.ip = *(__be32 *)nla_data(tb[CTA_IP_V4_SRC]);
+       t->dst.u3.ip = *(__be32 *)nla_data(tb[CTA_IP_V4_DST]);
 
        return 0;
 }
@@ -403,6 +399,7 @@ static struct nf_sockopt_ops so_getorigdst = {
        .get_optmin     = SO_ORIGINAL_DST,
        .get_optmax     = SO_ORIGINAL_DST+1,
        .get            = &getorigdst,
+       .owner          = THIS_MODULE,
 };
 
 struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
This page took 0.02729 seconds and 5 git commands to generate.