aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 37e0d4d5cf94..cb76e3c725a0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -82,7 +82,6 @@
82#include <linux/proc_fs.h> 82#include <linux/proc_fs.h>
83#include <linux/init.h> 83#include <linux/init.h>
84#include <linux/skbuff.h> 84#include <linux/skbuff.h>
85#include <linux/rtnetlink.h>
86#include <linux/inetdevice.h> 85#include <linux/inetdevice.h>
87#include <linux/igmp.h> 86#include <linux/igmp.h>
88#include <linux/pkt_sched.h> 87#include <linux/pkt_sched.h>
@@ -104,6 +103,7 @@
104#include <net/xfrm.h> 103#include <net/xfrm.h>
105#include <net/ip_mp_alg.h> 104#include <net/ip_mp_alg.h>
106#include <net/netevent.h> 105#include <net/netevent.h>
106#include <net/rtnetlink.h>
107#ifdef CONFIG_SYSCTL 107#ifdef CONFIG_SYSCTL
108#include <linux/sysctl.h> 108#include <linux/sysctl.h>
109#endif 109#endif
@@ -364,7 +364,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
364 return 0; 364 return 0;
365} 365}
366 366
367static struct seq_operations rt_cache_seq_ops = { 367static const struct seq_operations rt_cache_seq_ops = {
368 .start = rt_cache_seq_start, 368 .start = rt_cache_seq_start,
369 .next = rt_cache_seq_next, 369 .next = rt_cache_seq_next,
370 .stop = rt_cache_seq_stop, 370 .stop = rt_cache_seq_stop,
@@ -470,7 +470,7 @@ static int rt_cpu_seq_show(struct seq_file *seq, void *v)
470 return 0; 470 return 0;
471} 471}
472 472
473static struct seq_operations rt_cpu_seq_ops = { 473static const struct seq_operations rt_cpu_seq_ops = {
474 .start = rt_cpu_seq_start, 474 .start = rt_cpu_seq_start,
475 .next = rt_cpu_seq_next, 475 .next = rt_cpu_seq_next,
476 .stop = rt_cpu_seq_stop, 476 .stop = rt_cpu_seq_stop,
@@ -1519,7 +1519,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
1519static int ip_rt_bug(struct sk_buff *skb) 1519static int ip_rt_bug(struct sk_buff *skb)
1520{ 1520{
1521 printk(KERN_DEBUG "ip_rt_bug: %u.%u.%u.%u -> %u.%u.%u.%u, %s\n", 1521 printk(KERN_DEBUG "ip_rt_bug: %u.%u.%u.%u -> %u.%u.%u.%u, %s\n",
1522 NIPQUAD(skb->nh.iph->saddr), NIPQUAD(skb->nh.iph->daddr), 1522 NIPQUAD(ip_hdr(skb)->saddr), NIPQUAD(ip_hdr(skb)->daddr),
1523 skb->dev ? skb->dev->name : "?"); 1523 skb->dev ? skb->dev->name : "?");
1524 kfree_skb(skb); 1524 kfree_skb(skb);
1525 return 0; 1525 return 0;
@@ -1698,9 +1698,9 @@ static void ip_handle_martian_source(struct net_device *dev,
1698 printk(KERN_WARNING "martian source %u.%u.%u.%u from " 1698 printk(KERN_WARNING "martian source %u.%u.%u.%u from "
1699 "%u.%u.%u.%u, on dev %s\n", 1699 "%u.%u.%u.%u, on dev %s\n",
1700 NIPQUAD(daddr), NIPQUAD(saddr), dev->name); 1700 NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
1701 if (dev->hard_header_len && skb->mac.raw) { 1701 if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
1702 int i; 1702 int i;
1703 unsigned char *p = skb->mac.raw; 1703 const unsigned char *p = skb_mac_header(skb);
1704 printk(KERN_WARNING "ll header: "); 1704 printk(KERN_WARNING "ll header: ");
1705 for (i = 0; i < dev->hard_header_len; i++, p++) { 1705 for (i = 0; i < dev->hard_header_len; i++, p++) {
1706 printk("%02x", *p); 1706 printk("%02x", *p);
@@ -2134,7 +2134,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2134 rcu_read_lock(); 2134 rcu_read_lock();
2135 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) { 2135 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) {
2136 int our = ip_check_mc(in_dev, daddr, saddr, 2136 int our = ip_check_mc(in_dev, daddr, saddr,
2137 skb->nh.iph->protocol); 2137 ip_hdr(skb)->protocol);
2138 if (our 2138 if (our
2139#ifdef CONFIG_IP_MROUTE 2139#ifdef CONFIG_IP_MROUTE
2140 || (!LOCAL_MCAST(daddr) && IN_DEV_MFORWARD(in_dev)) 2140 || (!LOCAL_MCAST(daddr) && IN_DEV_MFORWARD(in_dev))
@@ -2396,7 +2396,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2396 2396
2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2398 dev_out = ip_dev_find(oldflp->fl4_src); 2398 dev_out = ip_dev_find(oldflp->fl4_src);
2399 if (dev_out == NULL) 2399 if ((dev_out == NULL) && !(sysctl_ip_nonlocal_bind))
2400 goto out; 2400 goto out;
2401 2401
2402 /* I removed check for oif == dev_out->oif here. 2402 /* I removed check for oif == dev_out->oif here.
@@ -2407,7 +2407,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2407 of another iface. --ANK 2407 of another iface. --ANK
2408 */ 2408 */
2409 2409
2410 if (oldflp->oif == 0 2410 if (dev_out && oldflp->oif == 0
2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) { 2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) {
2412 /* Special hack: user can direct multicasts 2412 /* Special hack: user can direct multicasts
2413 and limited broadcast via necessary interface 2413 and limited broadcast via necessary interface
@@ -2683,7 +2683,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
2683 id = rt->peer->ip_id_count; 2683 id = rt->peer->ip_id_count;
2684 if (rt->peer->tcp_ts_stamp) { 2684 if (rt->peer->tcp_ts_stamp) {
2685 ts = rt->peer->tcp_ts; 2685 ts = rt->peer->tcp_ts;
2686 tsage = xtime.tv_sec - rt->peer->tcp_ts_stamp; 2686 tsage = get_seconds() - rt->peer->tcp_ts_stamp;
2687 } 2687 }
2688 } 2688 }
2689 2689
@@ -2721,7 +2721,7 @@ nla_put_failure:
2721 return -EMSGSIZE; 2721 return -EMSGSIZE;
2722} 2722}
2723 2723
2724int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) 2724static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2725{ 2725{
2726 struct rtmsg *rtm; 2726 struct rtmsg *rtm;
2727 struct nlattr *tb[RTA_MAX+1]; 2727 struct nlattr *tb[RTA_MAX+1];
@@ -2747,10 +2747,11 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2747 /* Reserve room for dummy headers, this skb can pass 2747 /* Reserve room for dummy headers, this skb can pass
2748 through good chunk of routing engine. 2748 through good chunk of routing engine.
2749 */ 2749 */
2750 skb->mac.raw = skb->nh.raw = skb->data; 2750 skb_reset_mac_header(skb);
2751 skb_reset_network_header(skb);
2751 2752
2752 /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */ 2753 /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
2753 skb->nh.iph->protocol = IPPROTO_ICMP; 2754 ip_hdr(skb)->protocol = IPPROTO_ICMP;
2754 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); 2755 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
2755 2756
2756 src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; 2757 src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;
@@ -3193,6 +3194,8 @@ int __init ip_rt_init(void)
3193 xfrm_init(); 3194 xfrm_init();
3194 xfrm4_init(); 3195 xfrm4_init();
3195#endif 3196#endif
3197 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL);
3198
3196 return rc; 3199 return rc;
3197} 3200}
3198 3201