]> err.no Git - linux-2.6/blobdiff - net/ipv4/ip_options.c
[NETFILTER]: nf_nat: kill helper and seq_adjust hooks
[linux-2.6] / net / ipv4 / ip_options.c
index aeed4e5858ec2305e8c1e786bd7e6d75131b612e..d107543d3f81b4d13a0e788272a6ac8243c9a155 100644 (file)
@@ -145,7 +145,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
                                                __be32 addr;
 
                                                memcpy(&addr, sptr+soffset-1, 4);
-                                               if (inet_addr_type(&init_net, addr) != RTN_LOCAL) {
+                                               if (inet_addr_type(dev_net(skb->dst->dev), addr) != RTN_LOCAL) {
                                                        dopt->ts_needtime = 1;
                                                        soffset += 8;
                                                }
@@ -248,7 +248,8 @@ void ip_options_fragment(struct sk_buff * skb)
  * If opt == NULL, then skb->data should point to IP header.
  */
 
-int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
+int ip_options_compile(struct net *net,
+                      struct ip_options * opt, struct sk_buff * skb)
 {
        int l;
        unsigned char * iph;
@@ -389,7 +390,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
                                        {
                                                __be32 addr;
                                                memcpy(&addr, &optptr[optptr[2]-1], 4);
-                                               if (inet_addr_type(&init_net, addr) == RTN_UNICAST)
+                                               if (inet_addr_type(net, addr) == RTN_UNICAST)
                                                        break;
                                                if (skb)
                                                        timeptr = (__be32*)&optptr[optptr[2]+3];
@@ -506,13 +507,13 @@ static struct ip_options *ip_options_get_alloc(const int optlen)
                       GFP_KERNEL);
 }
 
-static int ip_options_get_finish(struct ip_options **optp,
+static int ip_options_get_finish(struct net *net, struct ip_options **optp,
                                 struct ip_options *opt, int optlen)
 {
        while (optlen & 3)
                opt->__data[optlen++] = IPOPT_END;
        opt->optlen = optlen;
-       if (optlen && ip_options_compile(opt, NULL)) {
+       if (optlen && ip_options_compile(net, opt, NULL)) {
                kfree(opt);
                return -EINVAL;
        }
@@ -521,7 +522,8 @@ static int ip_options_get_finish(struct ip_options **optp,
        return 0;
 }
 
-int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *data, int optlen)
+int ip_options_get_from_user(struct net *net, struct ip_options **optp,
+                            unsigned char __user *data, int optlen)
 {
        struct ip_options *opt = ip_options_get_alloc(optlen);
 
@@ -531,10 +533,11 @@ int ip_options_get_from_user(struct ip_options **optp, unsigned char __user *dat
                kfree(opt);
                return -EFAULT;
        }
-       return ip_options_get_finish(optp, opt, optlen);
+       return ip_options_get_finish(net, optp, opt, optlen);
 }
 
-int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen)
+int ip_options_get(struct net *net, struct ip_options **optp,
+                  unsigned char *data, int optlen)
 {
        struct ip_options *opt = ip_options_get_alloc(optlen);
 
@@ -542,7 +545,7 @@ int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen)
                return -ENOMEM;
        if (optlen)
                memcpy(opt->__data, data, optlen);
-       return ip_options_get_finish(optp, opt, optlen);
+       return ip_options_get_finish(net, optp, opt, optlen);
 }
 
 void ip_forward_options(struct sk_buff *skb)