Commit 4ebdfba7 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

dst: Pass a sk into .local_out

For consistency with the other similar methods in the kernel pass a
struct sock into the dst_ops .local_out method.

Simplifying the socket passing case is needed a prequel to passing a
struct net reference into .local_out.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 13206b6b
...@@ -74,9 +74,9 @@ static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie) ...@@ -74,9 +74,9 @@ static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie)
return dst; return dst;
} }
static int vrf_ip_local_out(struct sk_buff *skb) static int vrf_ip_local_out(struct sock *sk, struct sk_buff *skb)
{ {
return ip_local_out(skb); return ip_local_out_sk(sk, skb);
} }
static unsigned int vrf_v4_mtu(const struct dst_entry *dst) static unsigned int vrf_v4_mtu(const struct dst_entry *dst)
......
...@@ -28,7 +28,7 @@ struct dst_ops { ...@@ -28,7 +28,7 @@ struct dst_ops {
struct sk_buff *skb, u32 mtu); struct sk_buff *skb, u32 mtu);
void (*redirect)(struct dst_entry *dst, struct sock *sk, void (*redirect)(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb); struct sk_buff *skb);
int (*local_out)(struct sk_buff *skb); int (*local_out)(struct sock *sk, struct sk_buff *skb);
struct neighbour * (*neigh_lookup)(const struct dst_entry *dst, struct neighbour * (*neigh_lookup)(const struct dst_entry *dst,
struct sk_buff *skb, struct sk_buff *skb,
const void *daddr); const void *daddr);
......
...@@ -112,6 +112,7 @@ int ip_mc_output(struct sock *sk, struct sk_buff *skb); ...@@ -112,6 +112,7 @@ int ip_mc_output(struct sock *sk, struct sk_buff *skb);
int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
int (*output)(struct net *, struct sock *, struct sk_buff *)); int (*output)(struct net *, struct sock *, struct sk_buff *));
void ip_send_check(struct iphdr *ip); void ip_send_check(struct iphdr *ip);
int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb);
int __ip_local_out(struct sk_buff *skb); int __ip_local_out(struct sk_buff *skb);
int ip_local_out_sk(struct sock *sk, struct sk_buff *skb); int ip_local_out_sk(struct sock *sk, struct sk_buff *skb);
static inline int ip_local_out(struct sk_buff *skb) static inline int ip_local_out(struct sk_buff *skb)
......
...@@ -865,6 +865,7 @@ int ip6_forward(struct sk_buff *skb); ...@@ -865,6 +865,7 @@ int ip6_forward(struct sk_buff *skb);
int ip6_input(struct sk_buff *skb); int ip6_input(struct sk_buff *skb);
int ip6_mc_input(struct sk_buff *skb); int ip6_mc_input(struct sk_buff *skb);
int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb);
int __ip6_local_out(struct sk_buff *skb); int __ip6_local_out(struct sk_buff *skb);
int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb); int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb);
int ip6_local_out(struct sk_buff *skb); int ip6_local_out(struct sk_buff *skb);
......
...@@ -96,7 +96,7 @@ void ip_send_check(struct iphdr *iph) ...@@ -96,7 +96,7 @@ void ip_send_check(struct iphdr *iph)
} }
EXPORT_SYMBOL(ip_send_check); EXPORT_SYMBOL(ip_send_check);
static int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb) int __ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev); struct net *net = dev_net(skb_dst(skb)->dev);
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
......
...@@ -165,7 +165,7 @@ static struct dst_ops ipv4_dst_ops = { ...@@ -165,7 +165,7 @@ static struct dst_ops ipv4_dst_ops = {
.link_failure = ipv4_link_failure, .link_failure = ipv4_link_failure,
.update_pmtu = ip_rt_update_pmtu, .update_pmtu = ip_rt_update_pmtu,
.redirect = ip_do_redirect, .redirect = ip_do_redirect,
.local_out = __ip_local_out, .local_out = __ip_local_out_sk,
.neigh_lookup = ipv4_neigh_lookup, .neigh_lookup = ipv4_neigh_lookup,
}; };
......
...@@ -243,7 +243,7 @@ static struct dst_ops xfrm4_dst_ops = { ...@@ -243,7 +243,7 @@ static struct dst_ops xfrm4_dst_ops = {
.cow_metrics = dst_cow_metrics_generic, .cow_metrics = dst_cow_metrics_generic,
.destroy = xfrm4_dst_destroy, .destroy = xfrm4_dst_destroy,
.ifdown = xfrm4_dst_ifdown, .ifdown = xfrm4_dst_ifdown,
.local_out = __ip_local_out, .local_out = __ip_local_out_sk,
.gc_thresh = 32768, .gc_thresh = 32768,
}; };
......
...@@ -138,7 +138,7 @@ int ip6_dst_hoplimit(struct dst_entry *dst) ...@@ -138,7 +138,7 @@ int ip6_dst_hoplimit(struct dst_entry *dst)
EXPORT_SYMBOL(ip6_dst_hoplimit); EXPORT_SYMBOL(ip6_dst_hoplimit);
#endif #endif
static int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb) int __ip6_local_out_sk(struct sock *sk, struct sk_buff *skb)
{ {
struct net *net = dev_net(skb_dst(skb)->dev); struct net *net = dev_net(skb_dst(skb)->dev);
int len; int len;
......
...@@ -226,7 +226,7 @@ static struct dst_ops ip6_dst_ops_template = { ...@@ -226,7 +226,7 @@ static struct dst_ops ip6_dst_ops_template = {
.link_failure = ip6_link_failure, .link_failure = ip6_link_failure,
.update_pmtu = ip6_rt_update_pmtu, .update_pmtu = ip6_rt_update_pmtu,
.redirect = rt6_do_redirect, .redirect = rt6_do_redirect,
.local_out = __ip6_local_out, .local_out = __ip6_local_out_sk,
.neigh_lookup = ip6_neigh_lookup, .neigh_lookup = ip6_neigh_lookup,
}; };
......
...@@ -285,7 +285,7 @@ static struct dst_ops xfrm6_dst_ops = { ...@@ -285,7 +285,7 @@ static struct dst_ops xfrm6_dst_ops = {
.cow_metrics = dst_cow_metrics_generic, .cow_metrics = dst_cow_metrics_generic,
.destroy = xfrm6_dst_destroy, .destroy = xfrm6_dst_destroy,
.ifdown = xfrm6_dst_ifdown, .ifdown = xfrm6_dst_ifdown,
.local_out = __ip6_local_out, .local_out = __ip6_local_out_sk,
.gc_thresh = 32768, .gc_thresh = 32768,
}; };
......
...@@ -136,7 +136,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err) ...@@ -136,7 +136,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err)
while (likely((err = xfrm_output_one(skb, err)) == 0)) { while (likely((err = xfrm_output_one(skb, err)) == 0)) {
nf_reset(skb); nf_reset(skb);
err = skb_dst(skb)->ops->local_out(skb); err = skb_dst(skb)->ops->local_out(skb->sk, skb);
if (unlikely(err != 1)) if (unlikely(err != 1))
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment