Commit 511c3f92 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: skb->rtable accessor

Define skb_rtable(const struct sk_buff *skb) accessor to get rtable from skb

Delete skb->rtable field

Setting rtable is not allowed, just set dst instead as rtable is an alias.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dfbf97f3
...@@ -115,7 +115,7 @@ static struct net_device * __init ipddp_init(void) ...@@ -115,7 +115,7 @@ static struct net_device * __init ipddp_init(void)
*/ */
static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev) static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
__be32 paddr = ((struct rtable*)skb->dst)->rt_gateway; __be32 paddr = skb_rtable(skb)->rt_gateway;
struct ddpehdr *ddp; struct ddpehdr *ddp;
struct ipddp_route *rt; struct ipddp_route *rt;
struct atalk_addr *our_addr; struct atalk_addr *our_addr;
......
...@@ -324,7 +324,6 @@ struct sk_buff { ...@@ -324,7 +324,6 @@ struct sk_buff {
union { union {
struct dst_entry *dst; struct dst_entry *dst;
struct rtable *rtable;
unsigned long _skb_dst; unsigned long _skb_dst;
}; };
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
...@@ -427,6 +426,11 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb, ...@@ -427,6 +426,11 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
enum dma_data_direction dir); enum dma_data_direction dir);
#endif #endif
static inline struct rtable *skb_rtable(const struct sk_buff *skb)
{
return (struct rtable *)skb->_skb_dst;
}
extern void kfree_skb(struct sk_buff *skb); extern void kfree_skb(struct sk_buff *skb);
extern void consume_skb(struct sk_buff *skb); extern void consume_skb(struct sk_buff *skb);
extern void __kfree_skb(struct sk_buff *skb); extern void __kfree_skb(struct sk_buff *skb);
......
...@@ -210,7 +210,7 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt) ...@@ -210,7 +210,7 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
static inline int inet_iif(const struct sk_buff *skb) static inline int inet_iif(const struct sk_buff *skb)
{ {
return skb->rtable->rt_iif; return skb_rtable(skb)->rt_iif;
} }
#endif /* _ROUTE_H */ #endif /* _ROUTE_H */
...@@ -228,6 +228,7 @@ int nf_bridge_copy_header(struct sk_buff *skb) ...@@ -228,6 +228,7 @@ int nf_bridge_copy_header(struct sk_buff *skb)
static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb) static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
{ {
struct nf_bridge_info *nf_bridge = skb->nf_bridge; struct nf_bridge_info *nf_bridge = skb->nf_bridge;
struct rtable *rt;
if (nf_bridge->mask & BRNF_PKT_TYPE) { if (nf_bridge->mask & BRNF_PKT_TYPE) {
skb->pkt_type = PACKET_OTHERHOST; skb->pkt_type = PACKET_OTHERHOST;
...@@ -235,12 +236,13 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb) ...@@ -235,12 +236,13 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
} }
nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
skb->rtable = bridge_parent_rtable(nf_bridge->physindev); rt = bridge_parent_rtable(nf_bridge->physindev);
if (!skb->rtable) { if (!rt) {
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
dst_hold(&skb->rtable->u.dst); dst_hold(&rt->u.dst);
skb->dst = &rt->u.dst;
skb->dev = nf_bridge->physindev; skb->dev = nf_bridge->physindev;
nf_bridge_push_encap_header(skb); nf_bridge_push_encap_header(skb);
...@@ -338,6 +340,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) ...@@ -338,6 +340,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
struct nf_bridge_info *nf_bridge = skb->nf_bridge; struct nf_bridge_info *nf_bridge = skb->nf_bridge;
struct rtable *rt;
int err; int err;
if (nf_bridge->mask & BRNF_PKT_TYPE) { if (nf_bridge->mask & BRNF_PKT_TYPE) {
...@@ -347,7 +350,6 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) ...@@ -347,7 +350,6 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
if (dnat_took_place(skb)) { if (dnat_took_place(skb)) {
if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
struct rtable *rt;
struct flowi fl = { struct flowi fl = {
.nl_u = { .nl_u = {
.ip4_u = { .ip4_u = {
...@@ -404,12 +406,13 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) ...@@ -404,12 +406,13 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
} }
} else { } else {
skb->rtable = bridge_parent_rtable(nf_bridge->physindev); rt = bridge_parent_rtable(nf_bridge->physindev);
if (!skb->rtable) { if (!rt) {
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
dst_hold(&skb->rtable->u.dst); dst_hold(&rt->u.dst);
skb->dst = &rt->u.dst;
} }
skb->dev = nf_bridge->physindev; skb->dev = nf_bridge->physindev;
...@@ -628,9 +631,11 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, ...@@ -628,9 +631,11 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
if (skb->rtable && skb->rtable == bridge_parent_rtable(in)) { struct rtable *rt = skb_rtable(skb);
dst_release(&skb->rtable->u.dst);
skb->rtable = NULL; if (rt && rt == bridge_parent_rtable(in)) {
dst_release(&rt->u.dst);
skb->dst = NULL;
} }
return NF_ACCEPT; return NF_ACCEPT;
......
...@@ -452,7 +452,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, ...@@ -452,7 +452,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct rtable *rt; struct rtable *rt;
struct flowi fl = { .oif = skb->rtable->rt_iif, struct flowi fl = { .oif = skb_rtable(skb)->rt_iif,
.nl_u = { .ip4_u = .nl_u = { .ip4_u =
{ .daddr = ip_hdr(skb)->saddr, { .daddr = ip_hdr(skb)->saddr,
.saddr = ip_hdr(skb)->daddr, .saddr = ip_hdr(skb)->daddr,
...@@ -514,7 +514,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -514,7 +514,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
return; return;
if (rxskb->rtable->rt_type != RTN_LOCAL) if (skb_rtable(rxskb)->rt_type != RTN_LOCAL)
return; return;
dst = dccp_v4_route_skb(net, ctl_sk, rxskb); dst = dccp_v4_route_skb(net, ctl_sk, rxskb);
...@@ -567,7 +567,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -567,7 +567,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
/* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */
if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
return 0; /* discard, don't send a reset here */ return 0; /* discard, don't send a reset here */
if (dccp_bad_service_code(sk, service)) { if (dccp_bad_service_code(sk, service)) {
......
...@@ -474,7 +474,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb) ...@@ -474,7 +474,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
return 1; return 1;
} }
paddr = skb->rtable->rt_gateway; paddr = skb_rtable(skb)->rt_gateway;
if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev)) if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev))
return 0; return 0;
...@@ -817,7 +817,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -817,7 +817,7 @@ static int arp_process(struct sk_buff *skb)
if (arp->ar_op == htons(ARPOP_REQUEST) && if (arp->ar_op == htons(ARPOP_REQUEST) &&
ip_route_input(skb, tip, sip, 0, dev) == 0) { ip_route_input(skb, tip, sip, 0, dev) == 0) {
rt = skb->rtable; rt = skb_rtable(skb);
addr_type = rt->rt_type; addr_type = rt->rt_type;
if (addr_type == RTN_LOCAL) { if (addr_type == RTN_LOCAL) {
......
...@@ -356,7 +356,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param, ...@@ -356,7 +356,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
{ {
struct ipcm_cookie ipc; struct ipcm_cookie ipc;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct net *net = dev_net(rt->u.dst.dev); struct net *net = dev_net(rt->u.dst.dev);
struct sock *sk; struct sock *sk;
struct inet_sock *inet; struct inet_sock *inet;
...@@ -416,7 +416,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) ...@@ -416,7 +416,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
struct iphdr *iph; struct iphdr *iph;
int room; int room;
struct icmp_bxm icmp_param; struct icmp_bxm icmp_param;
struct rtable *rt = skb_in->rtable; struct rtable *rt = skb_rtable(skb_in);
struct ipcm_cookie ipc; struct ipcm_cookie ipc;
__be32 saddr; __be32 saddr;
u8 tos; u8 tos;
...@@ -596,7 +596,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) ...@@ -596,7 +596,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
RT_TOS(tos), rt2->u.dst.dev); RT_TOS(tos), rt2->u.dst.dev);
dst_release(&rt2->u.dst); dst_release(&rt2->u.dst);
rt2 = skb_in->rtable; rt2 = skb_rtable(skb_in);
skb_in->dst = odst; skb_in->dst = odst;
} }
...@@ -926,7 +926,7 @@ static void icmp_address(struct sk_buff *skb) ...@@ -926,7 +926,7 @@ static void icmp_address(struct sk_buff *skb)
static void icmp_address_reply(struct sk_buff *skb) static void icmp_address_reply(struct sk_buff *skb)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct in_device *in_dev; struct in_device *in_dev;
struct in_ifaddr *ifa; struct in_ifaddr *ifa;
...@@ -970,7 +970,7 @@ static void icmp_discard(struct sk_buff *skb) ...@@ -970,7 +970,7 @@ static void icmp_discard(struct sk_buff *skb)
int icmp_rcv(struct sk_buff *skb) int icmp_rcv(struct sk_buff *skb)
{ {
struct icmphdr *icmph; struct icmphdr *icmph;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct net *net = dev_net(rt->u.dst.dev); struct net *net = dev_net(rt->u.dst.dev);
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
......
...@@ -948,7 +948,7 @@ int igmp_rcv(struct sk_buff *skb) ...@@ -948,7 +948,7 @@ int igmp_rcv(struct sk_buff *skb)
case IGMPV2_HOST_MEMBERSHIP_REPORT: case IGMPV2_HOST_MEMBERSHIP_REPORT:
case IGMPV3_HOST_MEMBERSHIP_REPORT: case IGMPV3_HOST_MEMBERSHIP_REPORT:
/* Is it our report looped back? */ /* Is it our report looped back? */
if (skb->rtable->fl.iif == 0) if (skb_rtable(skb)->fl.iif == 0)
break; break;
/* don't rely on MC router hearing unicast reports */ /* don't rely on MC router hearing unicast reports */
if (skb->pkt_type == PACKET_MULTICAST || if (skb->pkt_type == PACKET_MULTICAST ||
......
...@@ -81,7 +81,7 @@ int ip_forward(struct sk_buff *skb) ...@@ -81,7 +81,7 @@ int ip_forward(struct sk_buff *skb)
if (!xfrm4_route_forward(skb)) if (!xfrm4_route_forward(skb))
goto drop; goto drop;
rt = skb->rtable; rt = skb_rtable(skb);
if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
goto sr_failed; goto sr_failed;
......
...@@ -602,7 +602,7 @@ static int ipgre_rcv(struct sk_buff *skb) ...@@ -602,7 +602,7 @@ static int ipgre_rcv(struct sk_buff *skb)
#ifdef CONFIG_NET_IPGRE_BROADCAST #ifdef CONFIG_NET_IPGRE_BROADCAST
if (ipv4_is_multicast(iph->daddr)) { if (ipv4_is_multicast(iph->daddr)) {
/* Looped back packet, drop it! */ /* Looped back packet, drop it! */
if (skb->rtable->fl.iif == 0) if (skb_rtable(skb)->fl.iif == 0)
goto drop; goto drop;
stats->multicast++; stats->multicast++;
skb->pkt_type = PACKET_BROADCAST; skb->pkt_type = PACKET_BROADCAST;
...@@ -704,7 +704,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -704,7 +704,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
} }
if (skb->protocol == htons(ETH_P_IP)) { if (skb->protocol == htons(ETH_P_IP)) {
rt = skb->rtable; rt = skb_rtable(skb);
if ((dst = rt->rt_gateway) == 0) if ((dst = rt->rt_gateway) == 0)
goto tx_error_icmp; goto tx_error_icmp;
} }
......
...@@ -357,7 +357,7 @@ static int ip_rcv_finish(struct sk_buff *skb) ...@@ -357,7 +357,7 @@ static int ip_rcv_finish(struct sk_buff *skb)
if (iph->ihl > 5 && ip_rcv_options(skb)) if (iph->ihl > 5 && ip_rcv_options(skb))
goto drop; goto drop;
rt = skb->rtable; rt = skb_rtable(skb);
if (rt->rt_type == RTN_MULTICAST) { if (rt->rt_type == RTN_MULTICAST) {
IP_UPD_PO_STATS_BH(dev_net(rt->u.dst.dev), IPSTATS_MIB_INMCAST, IP_UPD_PO_STATS_BH(dev_net(rt->u.dst.dev), IPSTATS_MIB_INMCAST,
skb->len); skb->len);
......
...@@ -102,7 +102,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) ...@@ -102,7 +102,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
sptr = skb_network_header(skb); sptr = skb_network_header(skb);
dptr = dopt->__data; dptr = dopt->__data;
daddr = skb->rtable->rt_spec_dst; daddr = skb_rtable(skb)->rt_spec_dst;
if (sopt->rr) { if (sopt->rr) {
optlen = sptr[sopt->rr+1]; optlen = sptr[sopt->rr+1];
...@@ -257,7 +257,7 @@ int ip_options_compile(struct net *net, ...@@ -257,7 +257,7 @@ int ip_options_compile(struct net *net,
struct rtable *rt = NULL; struct rtable *rt = NULL;
if (skb != NULL) { if (skb != NULL) {
rt = skb->rtable; rt = skb_rtable(skb);
optptr = (unsigned char *)&(ip_hdr(skb)[1]); optptr = (unsigned char *)&(ip_hdr(skb)[1]);
} else } else
optptr = opt->__data; optptr = opt->__data;
...@@ -550,7 +550,7 @@ void ip_forward_options(struct sk_buff *skb) ...@@ -550,7 +550,7 @@ void ip_forward_options(struct sk_buff *skb)
{ {
struct ip_options * opt = &(IPCB(skb)->opt); struct ip_options * opt = &(IPCB(skb)->opt);
unsigned char * optptr; unsigned char * optptr;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
unsigned char *raw = skb_network_header(skb); unsigned char *raw = skb_network_header(skb);
if (opt->rr_needaddr) { if (opt->rr_needaddr) {
...@@ -598,7 +598,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) ...@@ -598,7 +598,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
__be32 nexthop; __be32 nexthop;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
unsigned char *optptr = skb_network_header(skb) + opt->srr; unsigned char *optptr = skb_network_header(skb) + opt->srr;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct rtable *rt2; struct rtable *rt2;
int err; int err;
...@@ -623,13 +623,13 @@ int ip_options_rcv_srr(struct sk_buff *skb) ...@@ -623,13 +623,13 @@ int ip_options_rcv_srr(struct sk_buff *skb)
} }
memcpy(&nexthop, &optptr[srrptr-1], 4); memcpy(&nexthop, &optptr[srrptr-1], 4);
rt = skb->rtable; rt = skb_rtable(skb);
skb->rtable = NULL; skb->dst = NULL;
err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev);
rt2 = skb->rtable; rt2 = skb_rtable(skb);
if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) {
ip_rt_put(rt2); ip_rt_put(rt2);
skb->rtable = rt; skb->dst = &rt->u.dst;
return -EINVAL; return -EINVAL;
} }
ip_rt_put(rt); ip_rt_put(rt);
......
...@@ -140,7 +140,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, ...@@ -140,7 +140,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
__be32 saddr, __be32 daddr, struct ip_options *opt) __be32 saddr, __be32 daddr, struct ip_options *opt)
{ {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct iphdr *iph; struct iphdr *iph;
/* Build the IP header. */ /* Build the IP header. */
...@@ -238,7 +238,7 @@ static int ip_finish_output(struct sk_buff *skb) ...@@ -238,7 +238,7 @@ static int ip_finish_output(struct sk_buff *skb)
int ip_mc_output(struct sk_buff *skb) int ip_mc_output(struct sk_buff *skb)
{ {
struct sock *sk = skb->sk; struct sock *sk = skb->sk;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct net_device *dev = rt->u.dst.dev; struct net_device *dev = rt->u.dst.dev;
/* /*
...@@ -319,7 +319,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) ...@@ -319,7 +319,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
/* Skip all of this if the packet is already routed, /* Skip all of this if the packet is already routed,
* f.e. by something like SCTP. * f.e. by something like SCTP.
*/ */
rt = skb->rtable; rt = skb_rtable(skb);
if (rt != NULL) if (rt != NULL)
goto packet_routed; goto packet_routed;
...@@ -440,7 +440,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -440,7 +440,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
unsigned int mtu, hlen, left, len, ll_rs, pad; unsigned int mtu, hlen, left, len, ll_rs, pad;
int offset; int offset;
__be16 not_last_frag; __be16 not_last_frag;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
int err = 0; int err = 0;
dev = rt->u.dst.dev; dev = rt->u.dst.dev;
...@@ -1362,7 +1362,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar ...@@ -1362,7 +1362,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
} replyopts; } replyopts;
struct ipcm_cookie ipc; struct ipcm_cookie ipc;
__be32 daddr; __be32 daddr;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
if (ip_options_echo(&replyopts.opt, skb)) if (ip_options_echo(&replyopts.opt, skb))
return; return;
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb) static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb)
{ {
struct in_pktinfo info; struct in_pktinfo info;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
info.ipi_addr.s_addr = ip_hdr(skb)->daddr; info.ipi_addr.s_addr = ip_hdr(skb)->daddr;
if (rt) { if (rt) {
......
...@@ -416,7 +416,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -416,7 +416,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
if (!dst) { if (!dst) {
/* NBMA tunnel */ /* NBMA tunnel */
if ((rt = skb->rtable) == NULL) { if ((rt = skb_rtable(skb)) == NULL) {
stats->tx_fifo_errors++; stats->tx_fifo_errors++;
goto tx_error; goto tx_error;
} }
......
...@@ -1354,7 +1354,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local ...@@ -1354,7 +1354,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
if (net->ipv4.vif_table[vif].dev != skb->dev) { if (net->ipv4.vif_table[vif].dev != skb->dev) {
int true_vifi; int true_vifi;
if (skb->rtable->fl.iif == 0) { if (skb_rtable(skb)->fl.iif == 0) {
/* It is our own packet, looped back. /* It is our own packet, looped back.
Very complicated situation... Very complicated situation...
...@@ -1430,7 +1430,7 @@ int ip_mr_input(struct sk_buff *skb) ...@@ -1430,7 +1430,7 @@ int ip_mr_input(struct sk_buff *skb)
{ {
struct mfc_cache *cache; struct mfc_cache *cache;
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
int local = skb->rtable->rt_flags&RTCF_LOCAL; int local = skb_rtable(skb)->rt_flags & RTCF_LOCAL;
/* Packet is looped back after forward, it should not be /* Packet is looped back after forward, it should not be
forwarded second time, but still can be delivered locally. forwarded second time, but still can be delivered locally.
...@@ -1646,7 +1646,7 @@ int ipmr_get_route(struct net *net, ...@@ -1646,7 +1646,7 @@ int ipmr_get_route(struct net *net,
{ {
int err; int err;
struct mfc_cache *cache; struct mfc_cache *cache;
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
read_lock(&mrt_lock); read_lock(&mrt_lock);
cache = ipmr_cache_find(net, rt->rt_src, rt->rt_dst); cache = ipmr_cache_find(net, rt->rt_src, rt->rt_dst);
......
...@@ -72,7 +72,7 @@ masquerade_tg(struct sk_buff *skb, const struct xt_target_param *par) ...@@ -72,7 +72,7 @@ masquerade_tg(struct sk_buff *skb, const struct xt_target_param *par)
return NF_ACCEPT; return NF_ACCEPT;
mr = par->targinfo; mr = par->targinfo;
rt = skb->rtable; rt = skb_rtable(skb);
newsrc = inet_select_addr(par->out, rt->rt_gateway, RT_SCOPE_UNIVERSE); newsrc = inet_select_addr(par->out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
if (!newsrc) { if (!newsrc) {
printk("MASQUERADE: %s ate my IP address\n", par->out->name); printk("MASQUERADE: %s ate my IP address\n", par->out->name);
......
...@@ -140,7 +140,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb, ...@@ -140,7 +140,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
const char *rep_buffer, const char *rep_buffer,
unsigned int rep_len) unsigned int rep_len)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct iphdr *iph; struct iphdr *iph;
struct tcphdr *tcph; struct tcphdr *tcph;
int oldlen, datalen; int oldlen, datalen;
...@@ -218,7 +218,7 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb, ...@@ -218,7 +218,7 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
const char *rep_buffer, const char *rep_buffer,
unsigned int rep_len) unsigned int rep_len)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct iphdr *iph; struct iphdr *iph;
struct udphdr *udph; struct udphdr *udph;
int datalen, oldlen; int datalen, oldlen;
......
...@@ -1064,7 +1064,8 @@ static int rt_garbage_collect(struct dst_ops *ops) ...@@ -1064,7 +1064,8 @@ static int rt_garbage_collect(struct dst_ops *ops)
out: return 0; out: return 0;
} }
static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) static int rt_intern_hash(unsigned hash, struct rtable *rt,
struct rtable **rp, struct sk_buff *skb)
{ {
struct rtable *rth, **rthp; struct rtable *rth, **rthp;
unsigned long now; unsigned long now;
...@@ -1114,7 +1115,10 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) ...@@ -1114,7 +1115,10 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
spin_unlock_bh(rt_hash_lock_addr(hash)); spin_unlock_bh(rt_hash_lock_addr(hash));
rt_drop(rt); rt_drop(rt);
*rp = rth; if (rp)
*rp = rth;
else
skb->dst = &rth->u.dst;
return 0; return 0;
} }
...@@ -1210,7 +1214,10 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) ...@@ -1210,7 +1214,10 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
rcu_assign_pointer(rt_hash_table[hash].chain, rt); rcu_assign_pointer(rt_hash_table[hash].chain, rt);
spin_unlock_bh(rt_hash_lock_addr(hash)); spin_unlock_bh(rt_hash_lock_addr(hash));
*rp = rt; if (rp)
*rp = rt;
else
skb->dst = &rt->u.dst;
return 0; return 0;
} }
...@@ -1407,7 +1414,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, ...@@ -1407,7 +1414,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
&netevent); &netevent);
rt_del(hash, rth); rt_del(hash, rth);
if (!rt_intern_hash(hash, rt, &rt)) if (!rt_intern_hash(hash, rt, &rt, NULL))
ip_rt_put(rt); ip_rt_put(rt);
goto do_next; goto do_next;
} }
...@@ -1473,7 +1480,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) ...@@ -1473,7 +1480,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
void ip_rt_send_redirect(struct sk_buff *skb) void ip_rt_send_redirect(struct sk_buff *skb)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct in_device *in_dev = in_dev_get(rt->u.dst.dev); struct in_device *in_dev = in_dev_get(rt->u.dst.dev);
if (!in_dev) if (!in_dev)
...@@ -1521,7 +1528,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) ...@@ -1521,7 +1528,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
static int ip_error(struct sk_buff *skb) static int ip_error(struct sk_buff *skb)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
unsigned long now; unsigned long now;
int code; int code;
...@@ -1698,7 +1705,7 @@ static void ipv4_link_failure(struct sk_buff *skb) ...@@ -1698,7 +1705,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
rt = skb->rtable; rt = skb_rtable(skb);
if (rt) if (rt)
dst_set_expires(&rt->u.dst, 0); dst_set_expires(&rt->u.dst, 0);
} }
...@@ -1858,7 +1865,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1858,7 +1865,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
in_dev_put(in_dev); in_dev_put(in_dev);
hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
return rt_intern_hash(hash, rth, &skb->rtable); return rt_intern_hash(hash, rth, NULL, skb);
e_nobufs: e_nobufs:
in_dev_put(in_dev); in_dev_put(in_dev);
...@@ -2019,7 +2026,7 @@ static int ip_mkroute_input(struct sk_buff *skb, ...@@ -2019,7 +2026,7 @@ static int ip_mkroute_input(struct sk_buff *skb,
/* put it into the cache */ /* put it into the cache */
hash = rt_hash(daddr, saddr, fl->iif, hash = rt_hash(daddr, saddr, fl->iif,
rt_genid(dev_net(rth->u.dst.dev))); rt_genid(dev_net(rth->u.dst.dev)));
return rt_intern_hash(hash, rth, &skb->rtable); return rt_intern_hash(hash, rth, NULL, skb);
} }
/* /*
...@@ -2175,7 +2182,7 @@ out: return err; ...@@ -2175,7 +2182,7 @@ out: return err;
} }
rth->rt_type = res.type; rth->rt_type = res.type;
hash = rt_hash(daddr, saddr, fl.iif, rt_genid(net)); hash = rt_hash(daddr, saddr, fl.iif, rt_genid(net));
err = rt_intern_hash(hash, rth, &skb->rtable); err = rt_intern_hash(hash, rth, NULL, skb);
goto done; goto done;
no_route: no_route:
...@@ -2244,7 +2251,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -2244,7 +2251,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
dst_use(&rth->u.dst, jiffies); dst_use(&rth->u.dst, jiffies);
RT_CACHE_STAT_INC(in_hit); RT_CACHE_STAT_INC(in_hit);
rcu_read_unlock(); rcu_read_unlock();
skb->rtable = rth; skb->dst = &rth->u.dst;
return 0; return 0;
} }
RT_CACHE_STAT_INC(in_hlist_search); RT_CACHE_STAT_INC(in_hlist_search);
...@@ -2420,7 +2427,7 @@ static int ip_mkroute_output(struct rtable **rp, ...@@ -2420,7 +2427,7 @@ static int ip_mkroute_output(struct rtable **rp,
if (err == 0) { if (err == 0) {
hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif, hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif,
rt_genid(dev_net(dev_out))); rt_genid(dev_net(dev_out)));
err = rt_intern_hash(hash, rth, rp); err = rt_intern_hash(hash, rth, rp, NULL);
} }
return err; return err;
...@@ -2763,7 +2770,7 @@ static int rt_fill_info(struct net *net, ...@@ -2763,7 +2770,7 @@ static int rt_fill_info(struct net *net,
struct sk_buff *skb, u32 pid, u32 seq, int event, struct sk_buff *skb, u32 pid, u32 seq, int event,
int nowait, unsigned int flags) int nowait, unsigned int flags)
{ {
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct rtmsg *r; struct rtmsg *r;
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
long expires; long expires;
...@@ -2907,7 +2914,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void ...@@ -2907,7 +2914,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev); err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev);
local_bh_enable(); local_bh_enable();
rt = skb->rtable; rt = skb_rtable(skb);
if (err == 0 && rt->u.dst.error) if (err == 0 && rt->u.dst.error)
err = -rt->u.dst.error; err = -rt->u.dst.error;
} else { } else {
...@@ -2927,7 +2934,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void ...@@ -2927,7 +2934,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
if (err) if (err)
goto errout_free; goto errout_free;
skb->rtable = rt; skb->dst = &rt->u.dst;
if (rtm->rtm_flags & RTM_F_NOTIFY) if (rtm->rtm_flags & RTM_F_NOTIFY)
rt->rt_flags |= RTCF_NOTIFY; rt->rt_flags |= RTCF_NOTIFY;
......
...@@ -546,7 +546,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) ...@@ -546,7 +546,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
if (th->rst) if (th->rst)
return; return;
if (skb->rtable->rt_type != RTN_LOCAL) if (skb_rtable(skb)->rt_type != RTN_LOCAL)
return; return;
/* Swap the send and the receive. */ /* Swap the send and the receive. */
...@@ -1185,7 +1185,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -1185,7 +1185,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
#endif #endif
/* Never answer to SYNs send to broadcast or multicast */ /* Never answer to SYNs send to broadcast or multicast */
if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
goto drop; goto drop;
/* TW buckets are converted to open requests without /* TW buckets are converted to open requests without
......
...@@ -48,7 +48,7 @@ static int help(struct sk_buff *skb, unsigned int protoff, ...@@ -48,7 +48,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
{ {
struct nf_conntrack_expect *exp; struct nf_conntrack_expect *exp;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
struct rtable *rt = skb->rtable; struct rtable *rt = skb_rtable(skb);
struct in_device *in_dev; struct in_device *in_dev;
__be32 mask = 0; __be32 mask = 0;
......
...@@ -258,10 +258,10 @@ META_COLLECTOR(int_rtclassid) ...@@ -258,10 +258,10 @@ META_COLLECTOR(int_rtclassid)
META_COLLECTOR(int_rtiif) META_COLLECTOR(int_rtiif)
{ {
if (unlikely(skb->rtable == NULL)) if (unlikely(skb_rtable(skb) == NULL))
*err = -1; *err = -1;
else else
dst->value = skb->rtable->fl.iif; dst->value = skb_rtable(skb)->fl.iif;
} }
/************************************************************************** /**************************************************************************
......
...@@ -393,7 +393,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr, ...@@ -393,7 +393,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
return 0; return 0;
/* Is this a broadcast address? */ /* Is this a broadcast address? */
if (skb && skb->rtable->rt_flags & RTCF_BROADCAST) if (skb && skb_rtable(skb)->rt_flags & RTCF_BROADCAST)
return 0; return 0;
return 1; return 1;
...@@ -572,7 +572,7 @@ static void sctp_v4_get_saddr(struct sctp_sock *sk, ...@@ -572,7 +572,7 @@ static void sctp_v4_get_saddr(struct sctp_sock *sk,
/* What interface did this skb arrive on? */ /* What interface did this skb arrive on? */
static int sctp_v4_skb_iif(const struct sk_buff *skb) static int sctp_v4_skb_iif(const struct sk_buff *skb)
{ {
return skb->rtable->rt_iif; return skb_rtable(skb)->rt_iif;
} }
/* Was this packet marked by Explicit Congestion Notification? */ /* Was this packet marked by Explicit Congestion Notification? */
...@@ -848,8 +848,8 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, ...@@ -848,8 +848,8 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n",
__func__, skb, skb->len, __func__, skb, skb->len,
&skb->rtable->rt_src, &skb_rtable(skb)->rt_src,
&skb->rtable->rt_dst); &skb_rtable(skb)->rt_dst);
inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
IP_PMTUDISC_DO : IP_PMTUDISC_DONT; IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
......
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