net: Merge dst_output and dst_output_sk
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 16 Sep 2015 01:03:53 +0000 (20:03 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Sep 2015 00:18:32 +0000 (17:18 -0700)
Add a sock paramter to dst_output making dst_output_sk superfluous.
Add a skb->sk parameter to all of the callers of dst_output
Have the callers of dst_output_sk call dst_output.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19 files changed:
include/net/dst.h
net/decnet/dn_nsp_out.c
net/ipv4/ip_forward.c
net/ipv4/ip_output.c
net/ipv4/ip_vti.c
net/ipv4/ipmr.c
net/ipv4/raw.c
net/ipv4/xfrm4_output.c
net/ipv6/ip6_output.c
net/ipv6/ip6_vti.c
net/ipv6/ip6mr.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/output_core.c
net/ipv6/raw.c
net/ipv6/xfrm6_output.c
net/netfilter/ipvs/ip_vs_xmit.c
net/xfrm/xfrm_output.c
net/xfrm/xfrm_policy.c

index 9261d928303d475a8ef2772144f9f70e0febda49..c72e58474e52c4f3ea81e89302342d5d5d48f66f 100644 (file)
@@ -454,14 +454,10 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
 }
 
 /* Output packet to network from transport.  */
-static inline int dst_output_sk(struct sock *sk, struct sk_buff *skb)
+static inline int dst_output(struct sock *sk, struct sk_buff *skb)
 {
        return skb_dst(skb)->output(sk, skb);
 }
-static inline int dst_output(struct sk_buff *skb)
-{
-       return dst_output_sk(skb->sk, skb);
-}
 
 /* Input packet from network to transport.  */
 static inline int dst_input(struct sk_buff *skb)
index 1aaa51ebbda6ed1271b2a44820860f4d338b2f66..4b02dd300f5072f97e25aea310e6dea67d26cfee 100644 (file)
@@ -85,7 +85,7 @@ static void dn_nsp_send(struct sk_buff *skb)
        if (dst) {
 try_again:
                skb_dst_set(skb, dst);
-               dst_output(skb);
+               dst_output(skb->sk, skb);
                return;
        }
 
@@ -582,7 +582,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
         * associations.
         */
        skb_dst_set(skb, dst_clone(dst));
-       dst_output(skb);
+       dst_output(skb->sk, skb);
 }
 
 
index 2d3aa408fbdca19230224269ebbcc7124dc7f5bb..28fb90108f56dce480df7b600b99426cdfec6769 100644 (file)
@@ -72,7 +72,7 @@ static int ip_forward_finish(struct sock *sk, struct sk_buff *skb)
                ip_forward_options(skb);
 
        skb_sender_cpu_clear(skb);
-       return dst_output_sk(sk, skb);
+       return dst_output(sk, skb);
 }
 
 int ip_forward(struct sk_buff *skb)
index 0138fada0951b17b175be0b215c248fc7224dc5a..f076f11aa94a11cbc502ff500bea0fd30a9eb914 100644 (file)
@@ -102,7 +102,7 @@ static int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
        iph->tot_len = htons(skb->len);
        ip_send_check(iph);
        return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, sk, skb, NULL,
-                      skb_dst(skb)->dev, dst_output_sk);
+                      skb_dst(skb)->dev, dst_output);
 }
 
 int __ip_local_out(struct sk_buff *skb)
@@ -116,7 +116,7 @@ int ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
 
        err = __ip_local_out(skb);
        if (likely(err == 1))
-               err = dst_output_sk(sk, skb);
+               err = dst_output(sk, skb);
 
        return err;
 }
@@ -271,7 +271,7 @@ static int ip_finish_output(struct sock *sk, struct sk_buff *skb)
        /* Policy lookup after SNAT yielded a new policy */
        if (skb_dst(skb)->xfrm) {
                IPCB(skb)->flags |= IPSKB_REROUTED;
-               return dst_output_sk(sk, skb);
+               return dst_output(sk, skb);
        }
 #endif
        mtu = ip_skb_dst_mtu(skb);
index 0c152087ca15dd3f97548d3c7123d42bd6626f0e..3b87ec5178f986ad17f53d23fcd8e01402fe13a4 100644 (file)
@@ -197,7 +197,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
        skb_dst_set(skb, dst);
        skb->dev = skb_dst(skb)->dev;
 
-       err = dst_output(skb);
+       err = dst_output(skb->sk, skb);
        if (net_xmit_eval(err) == 0)
                err = skb->len;
        iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
index 866ee89f5254a4d6b401c4d9152d15640802b6b8..a0a5def920fc21dd46e5fa8d0fb7423a35875951 100644 (file)
@@ -1688,7 +1688,7 @@ static inline int ipmr_forward_finish(struct sock *sk, struct sk_buff *skb)
        if (unlikely(opt->optlen))
                ip_forward_options(skb);
 
-       return dst_output_sk(sk, skb);
+       return dst_output(sk, skb);
 }
 
 /*
index 561cd4b8fc6e07b49222d788651e93c42ee3adcb..09ab5bb6913a35b4c3926f7969199a1a330d11fb 100644 (file)
@@ -412,7 +412,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
                        skb_transport_header(skb))->type);
 
        err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, sk, skb,
-                     NULL, rt->dst.dev, dst_output_sk);
+                     NULL, rt->dst.dev, dst_output);
        if (err > 0)
                err = net_xmit_errno(err);
        if (err)
index 2878dbfffeb7e769a32079f1a6b80061136a7efc..737f5e395a6a0cdf2abd43ff3696cb40518552bb 100644 (file)
@@ -87,7 +87,7 @@ static int __xfrm4_output(struct sock *sk, struct sk_buff *skb)
 #ifdef CONFIG_NETFILTER
        if (!x) {
                IPCB(skb)->flags |= IPSKB_REROUTED;
-               return dst_output_sk(sk, skb);
+               return dst_output(sk, skb);
        }
 #endif
 
index 26ea4793074004d0af1026bb378860b53baa0ad2..a80502c64523f42ec62c317fdcb8f580391d9c74 100644 (file)
@@ -225,7 +225,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
                IP6_UPD_PO_STATS(net, ip6_dst_idev(skb_dst(skb)),
                              IPSTATS_MIB_OUT, skb->len);
                return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
-                              NULL, dst->dev, dst_output_sk);
+                              NULL, dst->dev, dst_output);
        }
 
        skb->dev = dst->dev;
@@ -320,7 +320,7 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
 static inline int ip6_forward_finish(struct sock *sk, struct sk_buff *skb)
 {
        skb_sender_cpu_clear(skb);
-       return dst_output_sk(sk, skb);
+       return dst_output(sk, skb);
 }
 
 static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
index 0224c032dca5dca98ea0146bcdf52c179fa23f6d..f96f1c19b4a8842cbc29dbe1288e0d001f34bd7e 100644 (file)
@@ -482,7 +482,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
                return -EMSGSIZE;
        }
 
-       err = dst_output(skb);
+       err = dst_output(skb->sk, skb);
        if (net_xmit_eval(err) == 0) {
                struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
 
index 0e004cc42a22b1593fa308f3adac735568ddf2ee..e95f6b6281dee5302ca1a96c9a39757fc83d569f 100644 (file)
@@ -1991,7 +1991,7 @@ static inline int ip6mr_forward2_finish(struct sock *sk, struct sk_buff *skb)
                         IPSTATS_MIB_OUTFORWDATAGRAMS);
        IP6_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), ip6_dst_idev(skb_dst(skb)),
                         IPSTATS_MIB_OUTOCTETS, skb->len);
-       return dst_output_sk(sk, skb);
+       return dst_output(sk, skb);
 }
 
 /*
index 083b2927fc67aaa3939fff42a1c6ee9f1ca70afe..5b3f2841acf67e194f75b2fec24c31286772be10 100644 (file)
@@ -1646,7 +1646,7 @@ static void mld_sendpack(struct sk_buff *skb)
 
        err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
                      net->ipv6.igmp_sk, skb, NULL, skb->dev,
-                     dst_output_sk);
+                     dst_output);
 out:
        if (!err) {
                ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
@@ -2009,7 +2009,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
 
        skb_dst_set(skb, dst);
        err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
-                     NULL, skb->dev, dst_output_sk);
+                     NULL, skb->dev, dst_output);
 out:
        if (!err) {
                ICMP6MSGOUT_INC_STATS(net, idev, type);
index 64a71354b069dd816199d1b1e23fe78082f2406a..349ac1b022b639b62d834d1784f320832390e3a6 100644 (file)
@@ -465,7 +465,7 @@ static void ndisc_send_skb(struct sk_buff *skb,
 
        err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
                      NULL, dst->dev,
-                     dst_output_sk);
+                     dst_output);
        if (!err) {
                ICMP6MSGOUT_INC_STATS(net, idev, type);
                ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
index 928a0fb0b74406cdf32c89fe7db054b40476dc54..8178f72fe90de3cb87d4ce44fdca2afa79bfed1a 100644 (file)
@@ -149,7 +149,7 @@ static int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb)
        IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
 
        return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
-                      NULL, skb_dst(skb)->dev, dst_output_sk);
+                      NULL, skb_dst(skb)->dev, dst_output);
 }
 
 int __ip6_local_out(struct sk_buff *skb)
@@ -164,7 +164,7 @@ int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb)
 
        err = __ip6_local_out_sk(sk, skb);
        if (likely(err == 1))
-               err = dst_output_sk(sk, skb);
+               err = dst_output(sk, skb);
 
        return err;
 }
index fdbada1569a37348b47b60769f7d679741b21d0a..1636537705f50f16ff14cfd6dae07885635c2115 100644 (file)
@@ -654,7 +654,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
 
        IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
        err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
-                     NULL, rt->dst.dev, dst_output_sk);
+                     NULL, rt->dst.dev, dst_output);
        if (err > 0)
                err = net_xmit_errno(err);
        if (err)
index 09c76a7b474dbcb12cae8aeba6fcba375d0d329a..b0fcd6c098378c5eee7a7a9541b616c6b08e970e 100644 (file)
@@ -140,7 +140,7 @@ static int __xfrm6_output(struct sock *sk, struct sk_buff *skb)
 #ifdef CONFIG_NETFILTER
        if (!x) {
                IP6CB(skb)->flags |= IP6SKB_REROUTED;
-               return dst_output_sk(sk, skb);
+               return dst_output(sk, skb);
        }
 #endif
 
index 258a0b0e82a293db38533a114c5c3a0bb2c03b9f..b8e5544af87f9ea3898a020863809cce26b6c280 100644 (file)
@@ -574,7 +574,7 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb,
                if (!skb->sk)
                        skb_sender_cpu_clear(skb);
                NF_HOOK(pf, NF_INET_LOCAL_OUT, NULL, skb,
-                       NULL, skb_dst(skb)->dev, dst_output_sk);
+                       NULL, skb_dst(skb)->dev, dst_output);
        } else
                ret = NF_ACCEPT;
 
@@ -596,7 +596,7 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb,
                if (!skb->sk)
                        skb_sender_cpu_clear(skb);
                NF_HOOK(pf, NF_INET_LOCAL_OUT, NULL, skb,
-                       NULL, skb_dst(skb)->dev, dst_output_sk);
+                       NULL, skb_dst(skb)->dev, dst_output);
        } else
                ret = NF_ACCEPT;
        return ret;
index 68ada2ca4b60707ac70b45aa6f0a9ea142a9dd16..57a50f6ce28c8763e090e88d28c8e6aee63af856 100644 (file)
@@ -139,7 +139,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err)
                        goto out;
 
                if (!skb_dst(skb)->xfrm)
-                       return dst_output(skb);
+                       return dst_output(skb->sk, skb);
 
                err = nf_hook(skb_dst(skb)->ops->family,
                              NF_INET_POST_ROUTING, skb->sk, skb,
index 6b5d6e2b9a4965655da71f888425fa5c8e2f203d..e7f64bcb78a8e08eb5a41d167311a8a5e3748fef 100644 (file)
@@ -1945,7 +1945,7 @@ static void xfrm_policy_queue_process(unsigned long arg)
                skb_dst_drop(skb);
                skb_dst_set(skb, dst);
 
-               dst_output(skb);
+               dst_output(skb->sk, skb);
        }
 
 out: