ipv4: Kill early demux method return value.
authorDavid S. Miller <davem@davemloft.net>
Thu, 28 Jun 2012 05:01:22 +0000 (22:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Jun 2012 05:01:22 +0000 (22:01 -0700)
It's completely unnecessary.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/protocol.h
include/net/tcp.h
net/ipv4/ip_input.c
net/ipv4/tcp_ipv4.c

index 967b926cbfb1fafe342b0fbfcc12aa795650ba1a..057f2d3155673cf302171b2c57dc0366505c524e 100644 (file)
@@ -37,7 +37,7 @@
 
 /* This is used to register protocols. */
 struct net_protocol {
-       int                     (*early_demux)(struct sk_buff *skb);
+       void                    (*early_demux)(struct sk_buff *skb);
        int                     (*handler)(struct sk_buff *skb);
        void                    (*err_handler)(struct sk_buff *skb, u32 info);
        int                     (*gso_send_check)(struct sk_buff *skb);
index 6660ffc4963df8bb34d123ed2e8d2294dcb2f743..53fb7d81417039a62c1449271ce62387a714838e 100644 (file)
@@ -325,7 +325,7 @@ extern void tcp_v4_err(struct sk_buff *skb, u32);
 
 extern void tcp_shutdown (struct sock *sk, int how);
 
-extern int tcp_v4_early_demux(struct sk_buff *skb);
+extern void tcp_v4_early_demux(struct sk_buff *skb);
 extern int tcp_v4_rcv(struct sk_buff *skb);
 
 extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
index 2a39204de5bc0236933da71c4ed530292d71f086..b27d4440f523d0d500cbb83a97ed4b6e46d125b6 100644 (file)
@@ -320,33 +320,29 @@ static int ip_rcv_finish(struct sk_buff *skb)
        const struct iphdr *iph = ip_hdr(skb);
        struct rtable *rt;
 
+       if (sysctl_ip_early_demux && !skb_dst(skb)) {
+               const struct net_protocol *ipprot;
+               int protocol = iph->protocol;
+
+               rcu_read_lock();
+               ipprot = rcu_dereference(inet_protos[protocol]);
+               if (ipprot && ipprot->early_demux)
+                       ipprot->early_demux(skb);
+               rcu_read_unlock();
+       }
+
        /*
         *      Initialise the virtual path cache for the packet. It describes
         *      how the packet travels inside Linux networking.
         */
-       if (skb_dst(skb) == NULL) {
-               int err = -ENOENT;
-
-               if (sysctl_ip_early_demux) {
-                       const struct net_protocol *ipprot;
-                       int protocol = iph->protocol;
-
-                       rcu_read_lock();
-                       ipprot = rcu_dereference(inet_protos[protocol]);
-                       if (ipprot && ipprot->early_demux)
-                               err = ipprot->early_demux(skb);
-                       rcu_read_unlock();
-               }
-
-               if (err) {
-                       err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
-                                                  iph->tos, skb->dev);
-                       if (unlikely(err)) {
-                               if (err == -EXDEV)
-                                       NET_INC_STATS_BH(dev_net(skb->dev),
-                                                        LINUX_MIB_IPRPFILTER);
-                               goto drop;
-                       }
+       if (!skb_dst(skb)) {
+               int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
+                                              iph->tos, skb->dev);
+               if (unlikely(err)) {
+                       if (err == -EXDEV)
+                               NET_INC_STATS_BH(dev_net(skb->dev),
+                                                LINUX_MIB_IPRPFILTER);
+                       goto drop;
                }
        }
 
index 1781dc650b9d3f07408e253a6b6258440acd3ac8..b4ae1c199f3e501d690bd1cadb54415f25c042ce 100644 (file)
@@ -1673,30 +1673,28 @@ csum_err:
 }
 EXPORT_SYMBOL(tcp_v4_do_rcv);
 
-int tcp_v4_early_demux(struct sk_buff *skb)
+void tcp_v4_early_demux(struct sk_buff *skb)
 {
        struct net *net = dev_net(skb->dev);
        const struct iphdr *iph;
        const struct tcphdr *th;
        struct net_device *dev;
        struct sock *sk;
-       int err;
 
-       err = -ENOENT;
        if (skb->pkt_type != PACKET_HOST)
-               goto out_err;
+               return;
 
        if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
-               goto out_err;
+               return;
 
        iph = ip_hdr(skb);
        th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
 
        if (th->doff < sizeof(struct tcphdr) / 4)
-               goto out_err;
+               return;
 
        if (!pskb_may_pull(skb, ip_hdrlen(skb) + th->doff * 4))
-               goto out_err;
+               return;
 
        dev = skb->dev;
        sk = __inet_lookup_established(net, &tcp_hashinfo,
@@ -1713,16 +1711,11 @@ int tcp_v4_early_demux(struct sk_buff *skb)
                        if (dst) {
                                struct rtable *rt = (struct rtable *) dst;
 
-                               if (rt->rt_iif == dev->ifindex) {
+                               if (rt->rt_iif == dev->ifindex)
                                        skb_dst_set_noref(skb, dst);
-                                       err = 0;
-                               }
                        }
                }
        }
-
-out_err:
-       return err;
 }
 
 /*