aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index aebb4e2d5ae3..b46ad53044ba 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -575,6 +575,8 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
575 return NULL; 575 return NULL;
576} 576}
577 577
578EXPORT_SYMBOL(rt6_lookup);
579
578/* ip6_ins_rt is called with FREE table->tb6_lock. 580/* ip6_ins_rt is called with FREE table->tb6_lock.
579 It takes new route entry, the addition fails by any reason the 581 It takes new route entry, the addition fails by any reason the
580 route is freed. In any case, if caller does not hold it, it may 582 route is freed. In any case, if caller does not hold it, it may
@@ -724,7 +726,7 @@ out2:
724 726
725void ip6_route_input(struct sk_buff *skb) 727void ip6_route_input(struct sk_buff *skb)
726{ 728{
727 struct ipv6hdr *iph = skb->nh.ipv6h; 729 struct ipv6hdr *iph = ipv6_hdr(skb);
728 int flags = RT6_LOOKUP_F_HAS_SADDR; 730 int flags = RT6_LOOKUP_F_HAS_SADDR;
729 struct flowi fl = { 731 struct flowi fl = {
730 .iif = skb->dev->ifindex, 732 .iif = skb->dev->ifindex,
@@ -829,6 +831,7 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
829 return fib6_rule_lookup(fl, flags, ip6_pol_route_output); 831 return fib6_rule_lookup(fl, flags, ip6_pol_route_output);
830} 832}
831 833
834EXPORT_SYMBOL(ip6_route_output);
832 835
833/* 836/*
834 * Destination cache support functions 837 * Destination cache support functions
@@ -1757,7 +1760,7 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1757 rtnl_unlock(); 1760 rtnl_unlock();
1758 1761
1759 return err; 1762 return err;
1760 }; 1763 }
1761 1764
1762 return -EINVAL; 1765 return -EINVAL;
1763} 1766}
@@ -1772,7 +1775,7 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
1772 int type; 1775 int type;
1773 switch (ipstats_mib_noroutes) { 1776 switch (ipstats_mib_noroutes) {
1774 case IPSTATS_MIB_INNOROUTES: 1777 case IPSTATS_MIB_INNOROUTES:
1775 type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1778 type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
1776 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { 1779 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
1777 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); 1780 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
1778 break; 1781 break;
@@ -2012,7 +2015,7 @@ errout:
2012 return err; 2015 return err;
2013} 2016}
2014 2017
2015int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 2018static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2016{ 2019{
2017 struct fib6_config cfg; 2020 struct fib6_config cfg;
2018 int err; 2021 int err;
@@ -2024,7 +2027,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2024 return ip6_route_del(&cfg); 2027 return ip6_route_del(&cfg);
2025} 2028}
2026 2029
2027int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 2030static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2028{ 2031{
2029 struct fib6_config cfg; 2032 struct fib6_config cfg;
2030 int err; 2033 int err;
@@ -2161,7 +2164,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
2161 prefix, NLM_F_MULTI); 2164 prefix, NLM_F_MULTI);
2162} 2165}
2163 2166
2164int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) 2167static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2165{ 2168{
2166 struct nlattr *tb[RTA_MAX+1]; 2169 struct nlattr *tb[RTA_MAX+1];
2167 struct rt6_info *rt; 2170 struct rt6_info *rt;
@@ -2215,7 +2218,7 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2215 /* Reserve room for dummy headers, this skb can pass 2218 /* Reserve room for dummy headers, this skb can pass
2216 through good chunk of routing engine. 2219 through good chunk of routing engine.
2217 */ 2220 */
2218 skb->mac.raw = skb->data; 2221 skb_reset_mac_header(skb);
2219 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); 2222 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
2220 2223
2221 rt = (struct rt6_info*) ip6_route_output(NULL, &fl); 2224 rt = (struct rt6_info*) ip6_route_output(NULL, &fl);
@@ -2486,8 +2489,9 @@ ctl_table ipv6_route_table[] = {
2486 2489
2487void __init ip6_route_init(void) 2490void __init ip6_route_init(void)
2488{ 2491{
2492#ifdef CONFIG_PROC_FS
2489 struct proc_dir_entry *p; 2493 struct proc_dir_entry *p;
2490 2494#endif
2491 ip6_dst_ops.kmem_cachep = 2495 ip6_dst_ops.kmem_cachep =
2492 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, 2496 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
2493 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 2497 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
@@ -2505,6 +2509,10 @@ void __init ip6_route_init(void)
2505#ifdef CONFIG_IPV6_MULTIPLE_TABLES 2509#ifdef CONFIG_IPV6_MULTIPLE_TABLES
2506 fib6_rules_init(); 2510 fib6_rules_init();
2507#endif 2511#endif
2512
2513 __rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL);
2514 __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL);
2515 __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL);
2508} 2516}
2509 2517
2510void ip6_route_cleanup(void) 2518void ip6_route_cleanup(void)