aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-03-05 21:30:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-05 21:30:47 -0500
commitee6b967301b4aa5d4a4b61e2f682f086266db9fb (patch)
tree197c2430f87733dc80d00d1971f1be2a0e562358
parenta05c44f6d5fb6cd29da04f96bf5ffaa05f545ac5 (diff)
[IPV4]: Add 'rtable' field in struct sk_buff to alias 'dst' and avoid casts
(Anonymous) unions can help us to avoid ugly casts. A common cast it the (struct rtable *)skb->dst one. Defining an union like : union { struct dst_entry *dst; struct rtable *rtable; }; permits to use skb->rtable in place. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/net/inet_sock.h2
-rw-r--r--net/bridge/br_netfilter.c14
-rw-r--r--net/dccp/ipv4.c7
-rw-r--r--net/ipv4/arp.c4
-rw-r--r--net/ipv4/icmp.c10
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/ip_options.c16
-rw-r--r--net/ipv4/ip_output.c10
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipip.c2
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/netfilter/ipt_MASQUERADE.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_helper.c4
-rw-r--r--net/ipv4/route.c22
-rw-r--r--net/ipv4/tcp_ipv4.c5
-rw-r--r--net/ipv4/udp_ipv4.c2
-rw-r--r--net/netfilter/nf_conntrack_netbios_ns.c2
-rw-r--r--net/sched/em_meta.c4
-rw-r--r--net/sctp/protocol.c8
23 files changed, 69 insertions, 68 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bbd8d0027e2f..7beb239d2ee0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -256,7 +256,10 @@ struct sk_buff {
256 ktime_t tstamp; 256 ktime_t tstamp;
257 struct net_device *dev; 257 struct net_device *dev;
258 258
259 struct dst_entry *dst; 259 union {
260 struct dst_entry *dst;
261 struct rtable *rtable;
262 };
260 struct sec_path *sp; 263 struct sec_path *sp;
261 264
262 /* 265 /*
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 89cd011edb99..8660cb0fa0dd 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -195,7 +195,7 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
195 195
196static inline int inet_iif(const struct sk_buff *skb) 196static inline int inet_iif(const struct sk_buff *skb)
197{ 197{
198 return ((struct rtable *)skb->dst)->rt_iif; 198 return skb->rtable->rt_iif;
199} 199}
200 200
201#endif /* _INET_SOCK_H */ 201#endif /* _INET_SOCK_H */
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 1c0efd8ad9f3..0278a069c6f1 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -223,8 +223,8 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
223 } 223 }
224 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 224 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
225 225
226 skb->dst = (struct dst_entry *)&__fake_rtable; 226 skb->rtable = &__fake_rtable;
227 dst_hold(skb->dst); 227 dst_hold(&__fake_rtable.u.dst);
228 228
229 skb->dev = nf_bridge->physindev; 229 skb->dev = nf_bridge->physindev;
230 nf_bridge_push_encap_header(skb); 230 nf_bridge_push_encap_header(skb);
@@ -388,8 +388,8 @@ bridged_dnat:
388 skb->pkt_type = PACKET_HOST; 388 skb->pkt_type = PACKET_HOST;
389 } 389 }
390 } else { 390 } else {
391 skb->dst = (struct dst_entry *)&__fake_rtable; 391 skb->rtable = &__fake_rtable;
392 dst_hold(skb->dst); 392 dst_hold(&__fake_rtable.u.dst);
393 } 393 }
394 394
395 skb->dev = nf_bridge->physindev; 395 skb->dev = nf_bridge->physindev;
@@ -608,9 +608,9 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
608 const struct net_device *out, 608 const struct net_device *out,
609 int (*okfn)(struct sk_buff *)) 609 int (*okfn)(struct sk_buff *))
610{ 610{
611 if (skb->dst == (struct dst_entry *)&__fake_rtable) { 611 if (skb->rtable == &__fake_rtable) {
612 dst_release(skb->dst); 612 dst_release(&__fake_rtable.u.dst);
613 skb->dst = NULL; 613 skb->rtable = NULL;
614 } 614 }
615 615
616 return NF_ACCEPT; 616 return NF_ACCEPT;
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 514a40b7fc7f..17ad69e90e48 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -450,7 +450,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
450 struct sk_buff *skb) 450 struct sk_buff *skb)
451{ 451{
452 struct rtable *rt; 452 struct rtable *rt;
453 struct flowi fl = { .oif = ((struct rtable *)skb->dst)->rt_iif, 453 struct flowi fl = { .oif = skb->rtable->rt_iif,
454 .nl_u = { .ip4_u = 454 .nl_u = { .ip4_u =
455 { .daddr = ip_hdr(skb)->saddr, 455 { .daddr = ip_hdr(skb)->saddr,
456 .saddr = ip_hdr(skb)->daddr, 456 .saddr = ip_hdr(skb)->daddr,
@@ -511,7 +511,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
511 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) 511 if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
512 return; 512 return;
513 513
514 if (((struct rtable *)rxskb->dst)->rt_type != RTN_LOCAL) 514 if (rxskb->rtable->rt_type != RTN_LOCAL)
515 return; 515 return;
516 516
517 dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb); 517 dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb);
@@ -563,8 +563,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
563 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); 563 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
564 564
565 /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ 565 /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */
566 if (((struct rtable *)skb->dst)->rt_flags & 566 if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
567 (RTCF_BROADCAST | RTCF_MULTICAST))
568 return 0; /* discard, don't send a reset here */ 567 return 0; /* discard, don't send a reset here */
569 568
570 if (dccp_bad_service_code(sk, service)) { 569 if (dccp_bad_service_code(sk, service)) {
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 69e80bd9774a..efe01df8fc0e 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -475,7 +475,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
475 return 1; 475 return 1;
476 } 476 }
477 477
478 paddr = ((struct rtable*)skb->dst)->rt_gateway; 478 paddr = skb->rtable->rt_gateway;
479 479
480 if (arp_set_predefined(inet_addr_type(&init_net, paddr), haddr, paddr, dev)) 480 if (arp_set_predefined(inet_addr_type(&init_net, paddr), haddr, paddr, dev))
481 return 0; 481 return 0;
@@ -814,7 +814,7 @@ static int arp_process(struct sk_buff *skb)
814 if (arp->ar_op == htons(ARPOP_REQUEST) && 814 if (arp->ar_op == htons(ARPOP_REQUEST) &&
815 ip_route_input(skb, tip, sip, 0, dev) == 0) { 815 ip_route_input(skb, tip, sip, 0, dev) == 0) {
816 816
817 rt = (struct rtable*)skb->dst; 817 rt = skb->rtable;
818 addr_type = rt->rt_type; 818 addr_type = rt->rt_type;
819 819
820 if (addr_type == RTN_LOCAL) { 820 if (addr_type == RTN_LOCAL) {
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index cee77d606fbe..ff9a8e643fcc 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -381,7 +381,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
381static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) 381static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
382{ 382{
383 struct ipcm_cookie ipc; 383 struct ipcm_cookie ipc;
384 struct rtable *rt = (struct rtable *)skb->dst; 384 struct rtable *rt = skb->rtable;
385 struct net *net = rt->u.dst.dev->nd_net; 385 struct net *net = rt->u.dst.dev->nd_net;
386 struct sock *sk = icmp_sk(net); 386 struct sock *sk = icmp_sk(net);
387 struct inet_sock *inet = inet_sk(sk); 387 struct inet_sock *inet = inet_sk(sk);
@@ -438,7 +438,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
438 struct iphdr *iph; 438 struct iphdr *iph;
439 int room; 439 int room;
440 struct icmp_bxm icmp_param; 440 struct icmp_bxm icmp_param;
441 struct rtable *rt = (struct rtable *)skb_in->dst; 441 struct rtable *rt = skb_in->rtable;
442 struct ipcm_cookie ipc; 442 struct ipcm_cookie ipc;
443 __be32 saddr; 443 __be32 saddr;
444 u8 tos; 444 u8 tos;
@@ -616,7 +616,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
616 RT_TOS(tos), rt2->u.dst.dev); 616 RT_TOS(tos), rt2->u.dst.dev);
617 617
618 dst_release(&rt2->u.dst); 618 dst_release(&rt2->u.dst);
619 rt2 = (struct rtable *)skb_in->dst; 619 rt2 = skb_in->rtable;
620 skb_in->dst = odst; 620 skb_in->dst = odst;
621 } 621 }
622 622
@@ -943,7 +943,7 @@ static void icmp_address(struct sk_buff *skb)
943 943
944static void icmp_address_reply(struct sk_buff *skb) 944static void icmp_address_reply(struct sk_buff *skb)
945{ 945{
946 struct rtable *rt = (struct rtable *)skb->dst; 946 struct rtable *rt = skb->rtable;
947 struct net_device *dev = skb->dev; 947 struct net_device *dev = skb->dev;
948 struct in_device *in_dev; 948 struct in_device *in_dev;
949 struct in_ifaddr *ifa; 949 struct in_ifaddr *ifa;
@@ -988,7 +988,7 @@ static void icmp_discard(struct sk_buff *skb)
988int icmp_rcv(struct sk_buff *skb) 988int icmp_rcv(struct sk_buff *skb)
989{ 989{
990 struct icmphdr *icmph; 990 struct icmphdr *icmph;
991 struct rtable *rt = (struct rtable *)skb->dst; 991 struct rtable *rt = skb->rtable;
992 992
993 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { 993 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
994 int nh; 994 int nh;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index d3f34a772f3b..6a4ee8da6994 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -948,7 +948,7 @@ int igmp_rcv(struct sk_buff *skb)
948 case IGMPV2_HOST_MEMBERSHIP_REPORT: 948 case IGMPV2_HOST_MEMBERSHIP_REPORT:
949 case IGMPV3_HOST_MEMBERSHIP_REPORT: 949 case IGMPV3_HOST_MEMBERSHIP_REPORT:
950 /* Is it our report looped back? */ 950 /* Is it our report looped back? */
951 if (((struct rtable*)skb->dst)->fl.iif == 0) 951 if (skb->rtable->fl.iif == 0)
952 break; 952 break;
953 /* don't rely on MC router hearing unicast reports */ 953 /* don't rely on MC router hearing unicast reports */
954 if (skb->pkt_type == PACKET_MULTICAST || 954 if (skb->pkt_type == PACKET_MULTICAST ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 0b3b328d82db..9d6d3befd854 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -80,7 +80,7 @@ int ip_forward(struct sk_buff *skb)
80 if (!xfrm4_route_forward(skb)) 80 if (!xfrm4_route_forward(skb))
81 goto drop; 81 goto drop;
82 82
83 rt = (struct rtable*)skb->dst; 83 rt = skb->rtable;
84 84
85 if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) 85 if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
86 goto sr_failed; 86 goto sr_failed;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index e7821ba7a9a0..f9ee84420cb3 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -619,7 +619,7 @@ static int ipgre_rcv(struct sk_buff *skb)
619#ifdef CONFIG_NET_IPGRE_BROADCAST 619#ifdef CONFIG_NET_IPGRE_BROADCAST
620 if (ipv4_is_multicast(iph->daddr)) { 620 if (ipv4_is_multicast(iph->daddr)) {
621 /* Looped back packet, drop it! */ 621 /* Looped back packet, drop it! */
622 if (((struct rtable*)skb->dst)->fl.iif == 0) 622 if (skb->rtable->fl.iif == 0)
623 goto drop; 623 goto drop;
624 tunnel->stat.multicast++; 624 tunnel->stat.multicast++;
625 skb->pkt_type = PACKET_BROADCAST; 625 skb->pkt_type = PACKET_BROADCAST;
@@ -699,7 +699,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
699 } 699 }
700 700
701 if (skb->protocol == htons(ETH_P_IP)) { 701 if (skb->protocol == htons(ETH_P_IP)) {
702 rt = (struct rtable*)skb->dst; 702 rt = skb->rtable;
703 if ((dst = rt->rt_gateway) == 0) 703 if ((dst = rt->rt_gateway) == 0)
704 goto tx_error_icmp; 704 goto tx_error_icmp;
705 } 705 }
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 65631391d479..d36e310b314d 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -351,7 +351,7 @@ static int ip_rcv_finish(struct sk_buff *skb)
351 if (iph->ihl > 5 && ip_rcv_options(skb)) 351 if (iph->ihl > 5 && ip_rcv_options(skb))
352 goto drop; 352 goto drop;
353 353
354 rt = (struct rtable*)skb->dst; 354 rt = skb->rtable;
355 if (rt->rt_type == RTN_MULTICAST) 355 if (rt->rt_type == RTN_MULTICAST)
356 IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS); 356 IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
357 else if (rt->rt_type == RTN_BROADCAST) 357 else if (rt->rt_type == RTN_BROADCAST)
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index baaedd9689a0..df93a9c2efda 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -107,7 +107,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
107 sptr = skb_network_header(skb); 107 sptr = skb_network_header(skb);
108 dptr = dopt->__data; 108 dptr = dopt->__data;
109 109
110 daddr = ((struct rtable*)skb->dst)->rt_spec_dst; 110 daddr = skb->rtable->rt_spec_dst;
111 111
112 if (sopt->rr) { 112 if (sopt->rr) {
113 optlen = sptr[sopt->rr+1]; 113 optlen = sptr[sopt->rr+1];
@@ -258,7 +258,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
258 unsigned char * optptr; 258 unsigned char * optptr;
259 int optlen; 259 int optlen;
260 unsigned char * pp_ptr = NULL; 260 unsigned char * pp_ptr = NULL;
261 struct rtable *rt = skb ? (struct rtable*)skb->dst : NULL; 261 struct rtable *rt = skb ? skb->rtable : NULL;
262 262
263 if (!opt) { 263 if (!opt) {
264 opt = &(IPCB(skb)->opt); 264 opt = &(IPCB(skb)->opt);
@@ -558,7 +558,7 @@ void ip_forward_options(struct sk_buff *skb)
558{ 558{
559 struct ip_options * opt = &(IPCB(skb)->opt); 559 struct ip_options * opt = &(IPCB(skb)->opt);
560 unsigned char * optptr; 560 unsigned char * optptr;
561 struct rtable *rt = (struct rtable*)skb->dst; 561 struct rtable *rt = skb->rtable;
562 unsigned char *raw = skb_network_header(skb); 562 unsigned char *raw = skb_network_header(skb);
563 563
564 if (opt->rr_needaddr) { 564 if (opt->rr_needaddr) {
@@ -606,7 +606,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
606 __be32 nexthop; 606 __be32 nexthop;
607 struct iphdr *iph = ip_hdr(skb); 607 struct iphdr *iph = ip_hdr(skb);
608 unsigned char *optptr = skb_network_header(skb) + opt->srr; 608 unsigned char *optptr = skb_network_header(skb) + opt->srr;
609 struct rtable *rt = (struct rtable*)skb->dst; 609 struct rtable *rt = skb->rtable;
610 struct rtable *rt2; 610 struct rtable *rt2;
611 int err; 611 int err;
612 612
@@ -631,13 +631,13 @@ int ip_options_rcv_srr(struct sk_buff *skb)
631 } 631 }
632 memcpy(&nexthop, &optptr[srrptr-1], 4); 632 memcpy(&nexthop, &optptr[srrptr-1], 4);
633 633
634 rt = (struct rtable*)skb->dst; 634 rt = skb->rtable;
635 skb->dst = NULL; 635 skb->rtable = NULL;
636 err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev); 636 err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev);
637 rt2 = (struct rtable*)skb->dst; 637 rt2 = skb->rtable;
638 if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) { 638 if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) {
639 ip_rt_put(rt2); 639 ip_rt_put(rt2);
640 skb->dst = &rt->u.dst; 640 skb->rtable = rt;
641 return -EINVAL; 641 return -EINVAL;
642 } 642 }
643 ip_rt_put(rt); 643 ip_rt_put(rt);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 341779e685d9..dc494ea594a7 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -142,7 +142,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
142 __be32 saddr, __be32 daddr, struct ip_options *opt) 142 __be32 saddr, __be32 daddr, struct ip_options *opt)
143{ 143{
144 struct inet_sock *inet = inet_sk(sk); 144 struct inet_sock *inet = inet_sk(sk);
145 struct rtable *rt = (struct rtable *)skb->dst; 145 struct rtable *rt = skb->rtable;
146 struct iphdr *iph; 146 struct iphdr *iph;
147 147
148 /* Build the IP header. */ 148 /* Build the IP header. */
@@ -240,7 +240,7 @@ static int ip_finish_output(struct sk_buff *skb)
240int ip_mc_output(struct sk_buff *skb) 240int ip_mc_output(struct sk_buff *skb)
241{ 241{
242 struct sock *sk = skb->sk; 242 struct sock *sk = skb->sk;
243 struct rtable *rt = (struct rtable*)skb->dst; 243 struct rtable *rt = skb->rtable;
244 struct net_device *dev = rt->u.dst.dev; 244 struct net_device *dev = rt->u.dst.dev;
245 245
246 /* 246 /*
@@ -321,7 +321,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
321 /* Skip all of this if the packet is already routed, 321 /* Skip all of this if the packet is already routed,
322 * f.e. by something like SCTP. 322 * f.e. by something like SCTP.
323 */ 323 */
324 rt = (struct rtable *) skb->dst; 324 rt = skb->rtable;
325 if (rt != NULL) 325 if (rt != NULL)
326 goto packet_routed; 326 goto packet_routed;
327 327
@@ -441,7 +441,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
441 unsigned int mtu, hlen, left, len, ll_rs, pad; 441 unsigned int mtu, hlen, left, len, ll_rs, pad;
442 int offset; 442 int offset;
443 __be16 not_last_frag; 443 __be16 not_last_frag;
444 struct rtable *rt = (struct rtable*)skb->dst; 444 struct rtable *rt = skb->rtable;
445 int err = 0; 445 int err = 0;
446 446
447 dev = rt->u.dst.dev; 447 dev = rt->u.dst.dev;
@@ -1357,7 +1357,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
1357 } replyopts; 1357 } replyopts;
1358 struct ipcm_cookie ipc; 1358 struct ipcm_cookie ipc;
1359 __be32 daddr; 1359 __be32 daddr;
1360 struct rtable *rt = (struct rtable*)skb->dst; 1360 struct rtable *rt = skb->rtable;
1361 1361
1362 if (ip_options_echo(&replyopts.opt, skb)) 1362 if (ip_options_echo(&replyopts.opt, skb))
1363 return; 1363 return;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index de0572c88859..e7c9e4e72327 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -57,7 +57,7 @@
57static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb) 57static void ip_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb)
58{ 58{
59 struct in_pktinfo info; 59 struct in_pktinfo info;
60 struct rtable *rt = (struct rtable *)skb->dst; 60 struct rtable *rt = skb->rtable;
61 61
62 info.ipi_addr.s_addr = ip_hdr(skb)->daddr; 62 info.ipi_addr.s_addr = ip_hdr(skb)->daddr;
63 if (rt) { 63 if (rt) {
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index dbaed69de06a..894bce96284a 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -528,7 +528,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
528 528
529 if (!dst) { 529 if (!dst) {
530 /* NBMA tunnel */ 530 /* NBMA tunnel */
531 if ((rt = (struct rtable*)skb->dst) == NULL) { 531 if ((rt = skb->rtable) == NULL) {
532 tunnel->stat.tx_fifo_errors++; 532 tunnel->stat.tx_fifo_errors++;
533 goto tx_error; 533 goto tx_error;
534 } 534 }
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index a94f52c207a7..7d63d74ef62a 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1283,7 +1283,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
1283 if (vif_table[vif].dev != skb->dev) { 1283 if (vif_table[vif].dev != skb->dev) {
1284 int true_vifi; 1284 int true_vifi;
1285 1285
1286 if (((struct rtable*)skb->dst)->fl.iif == 0) { 1286 if (skb->rtable->fl.iif == 0) {
1287 /* It is our own packet, looped back. 1287 /* It is our own packet, looped back.
1288 Very complicated situation... 1288 Very complicated situation...
1289 1289
@@ -1357,7 +1357,7 @@ dont_forward:
1357int ip_mr_input(struct sk_buff *skb) 1357int ip_mr_input(struct sk_buff *skb)
1358{ 1358{
1359 struct mfc_cache *cache; 1359 struct mfc_cache *cache;
1360 int local = ((struct rtable*)skb->dst)->rt_flags&RTCF_LOCAL; 1360 int local = skb->rtable->rt_flags&RTCF_LOCAL;
1361 1361
1362 /* Packet is looped back after forward, it should not be 1362 /* Packet is looped back after forward, it should not be
1363 forwarded second time, but still can be delivered locally. 1363 forwarded second time, but still can be delivered locally.
@@ -1594,7 +1594,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1594{ 1594{
1595 int err; 1595 int err;
1596 struct mfc_cache *cache; 1596 struct mfc_cache *cache;
1597 struct rtable *rt = (struct rtable*)skb->dst; 1597 struct rtable *rt = skb->rtable;
1598 1598
1599 read_lock(&mrt_lock); 1599 read_lock(&mrt_lock);
1600 cache = ipmr_cache_find(rt->rt_src, rt->rt_dst); 1600 cache = ipmr_cache_find(rt->rt_src, rt->rt_dst);
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
index 313b3fcf387e..c6817b18366a 100644
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
@@ -77,7 +77,7 @@ masquerade_tg(struct sk_buff *skb, const struct net_device *in,
77 return NF_ACCEPT; 77 return NF_ACCEPT;
78 78
79 mr = targinfo; 79 mr = targinfo;
80 rt = (struct rtable *)skb->dst; 80 rt = skb->rtable;
81 newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); 81 newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
82 if (!newsrc) { 82 if (!newsrc) {
83 printk("MASQUERADE: %s ate my IP address\n", out->name); 83 printk("MASQUERADE: %s ate my IP address\n", out->name);
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index ca57f47bbd25..2fca727aa8ba 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -139,7 +139,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
139 const char *rep_buffer, 139 const char *rep_buffer,
140 unsigned int rep_len) 140 unsigned int rep_len)
141{ 141{
142 struct rtable *rt = (struct rtable *)skb->dst; 142 struct rtable *rt = skb->rtable;
143 struct iphdr *iph; 143 struct iphdr *iph;
144 struct tcphdr *tcph; 144 struct tcphdr *tcph;
145 int oldlen, datalen; 145 int oldlen, datalen;
@@ -217,7 +217,7 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
217 const char *rep_buffer, 217 const char *rep_buffer,
218 unsigned int rep_len) 218 unsigned int rep_len)
219{ 219{
220 struct rtable *rt = (struct rtable *)skb->dst; 220 struct rtable *rt = skb->rtable;
221 struct iphdr *iph; 221 struct iphdr *iph;
222 struct udphdr *udph; 222 struct udphdr *udph;
223 int datalen, oldlen; 223 int datalen, oldlen;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8c3e165f0034..1051326c36b2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1289,7 +1289,7 @@ reject_redirect:
1289 1289
1290static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) 1290static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
1291{ 1291{
1292 struct rtable *rt = (struct rtable*)dst; 1292 struct rtable *rt = (struct rtable *)dst;
1293 struct dst_entry *ret = dst; 1293 struct dst_entry *ret = dst;
1294 1294
1295 if (rt) { 1295 if (rt) {
@@ -1330,7 +1330,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
1330 1330
1331void ip_rt_send_redirect(struct sk_buff *skb) 1331void ip_rt_send_redirect(struct sk_buff *skb)
1332{ 1332{
1333 struct rtable *rt = (struct rtable*)skb->dst; 1333 struct rtable *rt = skb->rtable;
1334 struct in_device *in_dev = in_dev_get(rt->u.dst.dev); 1334 struct in_device *in_dev = in_dev_get(rt->u.dst.dev);
1335 1335
1336 if (!in_dev) 1336 if (!in_dev)
@@ -1379,7 +1379,7 @@ out:
1379 1379
1380static int ip_error(struct sk_buff *skb) 1380static int ip_error(struct sk_buff *skb)
1381{ 1381{
1382 struct rtable *rt = (struct rtable*)skb->dst; 1382 struct rtable *rt = skb->rtable;
1383 unsigned long now; 1383 unsigned long now;
1384 int code; 1384 int code;
1385 1385
@@ -1548,7 +1548,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
1548 1548
1549 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); 1549 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
1550 1550
1551 rt = (struct rtable *) skb->dst; 1551 rt = skb->rtable;
1552 if (rt) 1552 if (rt)
1553 dst_set_expires(&rt->u.dst, 0); 1553 dst_set_expires(&rt->u.dst, 0);
1554} 1554}
@@ -1708,7 +1708,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1708 1708
1709 in_dev_put(in_dev); 1709 in_dev_put(in_dev);
1710 hash = rt_hash(daddr, saddr, dev->ifindex); 1710 hash = rt_hash(daddr, saddr, dev->ifindex);
1711 return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); 1711 return rt_intern_hash(hash, rth, &skb->rtable);
1712 1712
1713e_nobufs: 1713e_nobufs:
1714 in_dev_put(in_dev); 1714 in_dev_put(in_dev);
@@ -1869,7 +1869,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
1869 1869
1870 /* put it into the cache */ 1870 /* put it into the cache */
1871 hash = rt_hash(daddr, saddr, fl->iif); 1871 hash = rt_hash(daddr, saddr, fl->iif);
1872 return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); 1872 return rt_intern_hash(hash, rth, &skb->rtable);
1873} 1873}
1874 1874
1875/* 1875/*
@@ -2025,7 +2025,7 @@ local_input:
2025 } 2025 }
2026 rth->rt_type = res.type; 2026 rth->rt_type = res.type;
2027 hash = rt_hash(daddr, saddr, fl.iif); 2027 hash = rt_hash(daddr, saddr, fl.iif);
2028 err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); 2028 err = rt_intern_hash(hash, rth, &skb->rtable);
2029 goto done; 2029 goto done;
2030 2030
2031no_route: 2031no_route:
@@ -2091,7 +2091,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2091 dst_use(&rth->u.dst, jiffies); 2091 dst_use(&rth->u.dst, jiffies);
2092 RT_CACHE_STAT_INC(in_hit); 2092 RT_CACHE_STAT_INC(in_hit);
2093 rcu_read_unlock(); 2093 rcu_read_unlock();
2094 skb->dst = (struct dst_entry*)rth; 2094 skb->rtable = rth;
2095 return 0; 2095 return 0;
2096 } 2096 }
2097 RT_CACHE_STAT_INC(in_hlist_search); 2097 RT_CACHE_STAT_INC(in_hlist_search);
@@ -2598,7 +2598,7 @@ int ip_route_output_key(struct net *net, struct rtable **rp, struct flowi *flp)
2598static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, 2598static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
2599 int nowait, unsigned int flags) 2599 int nowait, unsigned int flags)
2600{ 2600{
2601 struct rtable *rt = (struct rtable*)skb->dst; 2601 struct rtable *rt = skb->rtable;
2602 struct rtmsg *r; 2602 struct rtmsg *r;
2603 struct nlmsghdr *nlh; 2603 struct nlmsghdr *nlh;
2604 long expires; 2604 long expires;
@@ -2742,7 +2742,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2742 err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev); 2742 err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev);
2743 local_bh_enable(); 2743 local_bh_enable();
2744 2744
2745 rt = (struct rtable*) skb->dst; 2745 rt = skb->rtable;
2746 if (err == 0 && rt->u.dst.error) 2746 if (err == 0 && rt->u.dst.error)
2747 err = -rt->u.dst.error; 2747 err = -rt->u.dst.error;
2748 } else { 2748 } else {
@@ -2762,7 +2762,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2762 if (err) 2762 if (err)
2763 goto errout_free; 2763 goto errout_free;
2764 2764
2765 skb->dst = &rt->u.dst; 2765 skb->rtable = rt;
2766 if (rtm->rtm_flags & RTM_F_NOTIFY) 2766 if (rtm->rtm_flags & RTM_F_NOTIFY)
2767 rt->rt_flags |= RTCF_NOTIFY; 2767 rt->rt_flags |= RTCF_NOTIFY;
2768 2768
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3873c4dbeaeb..a79e324638eb 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -552,7 +552,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
552 if (th->rst) 552 if (th->rst)
553 return; 553 return;
554 554
555 if (((struct rtable *)skb->dst)->rt_type != RTN_LOCAL) 555 if (skb->rtable->rt_type != RTN_LOCAL)
556 return; 556 return;
557 557
558 /* Swap the send and the receive. */ 558 /* Swap the send and the receive. */
@@ -1262,8 +1262,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1262#endif 1262#endif
1263 1263
1264 /* Never answer to SYNs send to broadcast or multicast */ 1264 /* Never answer to SYNs send to broadcast or multicast */
1265 if (((struct rtable *)skb->dst)->rt_flags & 1265 if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
1266 (RTCF_BROADCAST | RTCF_MULTICAST))
1267 goto drop; 1266 goto drop;
1268 1267
1269 /* TW buckets are converted to open requests without 1268 /* TW buckets are converted to open requests without
diff --git a/net/ipv4/udp_ipv4.c b/net/ipv4/udp_ipv4.c
index 40978de7fb51..fd14c2c50ed4 100644
--- a/net/ipv4/udp_ipv4.c
+++ b/net/ipv4/udp_ipv4.c
@@ -893,7 +893,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
893 struct sock *sk; 893 struct sock *sk;
894 struct udphdr *uh = udp_hdr(skb); 894 struct udphdr *uh = udp_hdr(skb);
895 unsigned short ulen; 895 unsigned short ulen;
896 struct rtable *rt = (struct rtable*)skb->dst; 896 struct rtable *rt = skb->rtable;
897 __be32 saddr = ip_hdr(skb)->saddr; 897 __be32 saddr = ip_hdr(skb)->saddr;
898 __be32 daddr = ip_hdr(skb)->daddr; 898 __be32 daddr = ip_hdr(skb)->daddr;
899 899
diff --git a/net/netfilter/nf_conntrack_netbios_ns.c b/net/netfilter/nf_conntrack_netbios_ns.c
index 9810d81e2a06..60dedaded84e 100644
--- a/net/netfilter/nf_conntrack_netbios_ns.c
+++ b/net/netfilter/nf_conntrack_netbios_ns.c
@@ -47,7 +47,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
47{ 47{
48 struct nf_conntrack_expect *exp; 48 struct nf_conntrack_expect *exp;
49 struct iphdr *iph = ip_hdr(skb); 49 struct iphdr *iph = ip_hdr(skb);
50 struct rtable *rt = (struct rtable *)skb->dst; 50 struct rtable *rt = skb->rtable;
51 struct in_device *in_dev; 51 struct in_device *in_dev;
52 __be32 mask = 0; 52 __be32 mask = 0;
53 53
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index 3da4129b89d1..72cf86e3c090 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -256,10 +256,10 @@ META_COLLECTOR(int_rtclassid)
256 256
257META_COLLECTOR(int_rtiif) 257META_COLLECTOR(int_rtiif)
258{ 258{
259 if (unlikely(skb->dst == NULL)) 259 if (unlikely(skb->rtable == NULL))
260 *err = -1; 260 *err = -1;
261 else 261 else
262 dst->value = ((struct rtable*) skb->dst)->fl.iif; 262 dst->value = skb->rtable->fl.iif;
263} 263}
264 264
265/************************************************************************** 265/**************************************************************************
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 8d9d929f6cea..1afef08f6c1d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -363,7 +363,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
363 return 0; 363 return 0;
364 364
365 /* Is this a broadcast address? */ 365 /* Is this a broadcast address? */
366 if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST) 366 if (skb && skb->rtable->rt_flags & RTCF_BROADCAST)
367 return 0; 367 return 0;
368 368
369 return 1; 369 return 1;
@@ -539,7 +539,7 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
539/* What interface did this skb arrive on? */ 539/* What interface did this skb arrive on? */
540static int sctp_v4_skb_iif(const struct sk_buff *skb) 540static int sctp_v4_skb_iif(const struct sk_buff *skb)
541{ 541{
542 return ((struct rtable *)skb->dst)->rt_iif; 542 return skb->rtable->rt_iif;
543} 543}
544 544
545/* Was this packet marked by Explicit Congestion Notification? */ 545/* Was this packet marked by Explicit Congestion Notification? */
@@ -828,8 +828,8 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
828 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " 828 SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, "
829 "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", 829 "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n",
830 __FUNCTION__, skb, skb->len, 830 __FUNCTION__, skb, skb->len,
831 NIPQUAD(((struct rtable *)skb->dst)->rt_src), 831 NIPQUAD(skb->rtable->rt_src),
832 NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); 832 NIPQUAD(skb->rtable->rt_dst));
833 833
834 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 834 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
835 return ip_queue_xmit(skb, ipfragok); 835 return ip_queue_xmit(skb, ipfragok);