Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ipv6/route.c File Reference

#include <linux/config.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/route.h>
#include <linux/netdevice.h>
#include <linux/in6.h>
#include <linux/init.h>
#include <linux/netlink.h>
#include <linux/if_arp.h>
#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/ip6_fib.h>
#include <net/ip6_route.h>
#include <net/ndisc.h>
#include <net/addrconf.h>
#include <net/tcp.h>
#include <linux/rtnetlink.h>
#include <asm/uaccess.h>

Include dependency graph for ipv6/route.c:

Go to the source code of this file.

Defines

#define RT6_DEBUG   2
#define RDBG(x)
#define RT6_TRACE(x...)   do { ; } while (0)
#define BUG_TRAP(x)   ({ if (!(x)) { printk("Assertion (" #x ") failed at " __FILE__ "(%d):" __FUNCTION__ "\n", __LINE__); } })
#define ip6_rt_policy   (0)
#define BACKTRACK()

Functions

static struct rt6_info * ip6_rt_copy (struct rt6_info *ort)
static struct dst_entryip6_dst_check (struct dst_entry *dst, u32 cookie)
static struct dst_entryip6_dst_reroute (struct dst_entry *dst, struct sk_buff *skb)
static struct dst_entryip6_negative_advice (struct dst_entry *)
static int ip6_dst_gc (void)
static int ip6_pkt_discard (struct sk_buff *skb)
static void ip6_link_failure (struct sk_buff *skb)
static __inline__ struct rt6_info * rt6_device_match (struct rt6_info *rt, int oif, int strict)
static struct rt6_info * rt6_best_dflt (struct rt6_info *rt, int oif)
rt6_info * rt6_lookup (struct in6_addr *daddr, struct in6_addr *saddr, int oif, int strict)
static int rt6_ins (struct rt6_info *rt)
static struct rt6_info * rt6_cow (struct rt6_info *ort, struct in6_addr *daddr, struct in6_addr *saddr)
void ip6_route_input (struct sk_buff *skb)
dst_entryip6_route_output (struct sock *sk, struct flowi *fl)
static void ipv6_wash_prefix (struct in6_addr *pfx, int plen)
static int ipv6_get_mtu (struct device *dev)
static int ipv6_get_hoplimit (struct device *dev)
int ip6_route_add (struct in6_rtmsg *rtmsg)
int ip6_del_rt (struct rt6_info *rt)
int ip6_route_del (struct in6_rtmsg *rtmsg)
void rt6_redirect (struct in6_addr *dest, struct in6_addr *saddr, struct neighbour *neigh, int on_link)
void rt6_pmtu_discovery (struct in6_addr *daddr, struct in6_addr *saddr, struct device *dev, u32 pmtu)
rt6_info * rt6_get_dflt_router (struct in6_addr *addr, struct device *dev)
rt6_info * rt6_add_dflt_router (struct in6_addr *gwaddr, struct device *dev)
void rt6_purge_dflt_routers (int last_resort)
int ipv6_route_ioctl (unsigned int cmd, void *arg)
int ip6_rt_addr_add (struct in6_addr *addr, struct device *dev)
int ip6_rt_addr_del (struct in6_addr *addr, struct device *dev)
static int fib6_ifdown (struct rt6_info *rt, void *arg)
void rt6_ifdown (struct device *dev)
static int rt6_mtu_change_route (struct rt6_info *rt, void *p_arg)
void rt6_mtu_change (struct device *dev, unsigned mtu)
 __initfunc (void ip6_route_init(void))

Variables

int ip6_rt_max_size = 4096
int ip6_rt_gc_min_interval = 5*HZ
int ip6_rt_gc_timeout = 60*HZ
int ip6_rt_gc_interval = 30*HZ
int ip6_rt_gc_elasticity = 9
int ip6_rt_mtu_expires = 10*60*HZ
dst_ops ip6_dst_ops
rt6_info ip6_null_entry
fib6_node ip6_routing_table
static struct rt6_info * rt6_dflt_pointer = NULL


Define Documentation

 
#define BACKTRACK  ) 
 

Value:

if (rt == &ip6_null_entry && strict) { \
       while ((fn = fn->parent) != NULL) { \
                if (fn->fn_flags & RTN_ROOT) { \
                        dst_clone(&rt->u.dst); \
                        goto out; \
                } \
                if (fn->fn_flags & RTN_RTINFO) \
                        goto restart; \
        } \
}

Definition at line 348 of file ipv6/route.c.

Referenced by ip6_route_input(), and ip6_route_output().

#define BUG_TRAP x   )     ({ if (!(x)) { printk("Assertion (" #x ") failed at " __FILE__ "(%d):" __FUNCTION__ "\n", __LINE__); } })
 

Definition at line 63 of file ipv6/route.c.

#define ip6_rt_policy   (0)
 

Definition at line 133 of file ipv6/route.c.

Referenced by ip6_route_input(), and ip6_route_output().

#define RDBG x   ) 
 

Definition at line 58 of file ipv6/route.c.

Referenced by ip6_dst_reroute(), ipv6_route_ioctl(), and rt6_best_dflt().

#define RT6_DEBUG   2
 

Definition at line 52 of file ipv6/route.c.

#define RT6_TRACE x...   )     do { ; } while (0)
 

Definition at line 59 of file ipv6/route.c.


Function Documentation

__initfunc void   ip6_route_init(void)  ) 
 

Definition at line 1948 of file ipv6/route.c.

References NETLINK_ROUTE6, and proc_net_register().

Here is the call graph for this function:

static int fib6_ifdown struct rt6_info *  rt,
void *  arg
[static]
 

Definition at line 1378 of file ipv6/route.c.

References ip6_null_entry, NULL, and RT6_TRACE.

Referenced by rt6_ifdown().

int ip6_del_rt struct rt6_info *  rt  ) 
 

Definition at line 743 of file ipv6/route.c.

References end_bh_atomic(), fib6_del(), NULL, rt6_dflt_pointer, and start_bh_atomic().

Referenced by addrconf_prefix_rcv(), ip6_negative_advice(), ip6_route_del(), ip6_rt_addr_del(), ndisc_rcv(), ndisc_router_discovery(), rt6_purge_dflt_routers(), and rt6_redirect().

Here is the call graph for this function:

static struct dst_entry * ip6_dst_check struct dst_entry dst,
u32  cookie
[static]
 

Definition at line 494 of file ipv6/route.c.

References NULL.

static int ip6_dst_gc void   )  [static]
 

Definition at line 545 of file ipv6/route.c.

References atomic_read, end_bh_atomic(), dst_ops::entries, fib6_run_gc(), dst_ops::gc_thresh, HZ, ip6_rt_gc_elasticity, ip6_rt_gc_min_interval, ip6_rt_gc_timeout, ip6_rt_max_size, jiffies, now, out, and start_bh_atomic().

Here is the call graph for this function:

static struct dst_entry * ip6_dst_reroute struct dst_entry dst,
struct sk_buff skb
[static]
 

Definition at line 507 of file ipv6/route.c.

References NULL, and RDBG.

static void ip6_link_failure struct sk_buff skb  )  [static]
 

Definition at line 529 of file ipv6/route.c.

References sk_buff::dev, sk_buff::dst, ICMPV6_ADDR_UNREACH, ICMPV6_DEST_UNREACH, icmpv6_send(), RTF_CACHE, RTF_DEFAULT, and RTF_EXPIRES.

Here is the call graph for this function:

static struct dst_entry * ip6_negative_advice struct dst_entry  )  [static]
 

Definition at line 517 of file ipv6/route.c.

References ip6_del_rt(), NULL, and RTF_CACHE.

Here is the call graph for this function:

int ip6_pkt_discard struct sk_buff skb  )  [static]
 

Definition at line 1202 of file ipv6/route.c.

References sk_buff::dev, ICMPV6_ADDR_UNREACH, ICMPV6_DEST_UNREACH, icmpv6_send(), ipv6_mib::Ip6OutNoRoutes, and ipv6_statistics.

Referenced by ip6_route_add().

Here is the call graph for this function:

int ip6_route_add struct in6_rtmsg rtmsg  ) 
 

Definition at line 610 of file ipv6/route.c.

References dev, dev_get_by_index(), device, dst_alloc(), EHOSTUNREACH, EINVAL, ENETUNREACH, ENODEV, ENOMEM, IFF_LOOPBACK, ip6_forward(), ip6_mc_input(), ip6_output(), ip6_pkt_discard(), IP6_RT_PRIO_USER, IPV6_ADDR_LINKLOCAL, IPV6_ADDR_LOOPBACK, IPV6_ADDR_MULTICAST, ipv6_addr_type(), IPV6_ADDR_UNICAST, IPV6_DEFAULT_MCASTHOPS, ipv6_get_hoplimit(), ipv6_get_mtu(), ipv6_wash_prefix(), loopback_dev, NULL, out, rt6_ins(), rt6_lookup(), RTF_GATEWAY, RTF_NONEXTHOP, RTF_REJECT, and TCP_TIMEOUT_INIT.

Referenced by addrconf_add_mroute(), addrconf_prefix_route(), addrconf_rs_timer(), ip6_fw_msg_add(), ipv6_route_ioctl(), rt6_add_dflt_router(), and sit_route_add().

Here is the call graph for this function:

int ip6_route_del struct in6_rtmsg rtmsg  ) 
 

Definition at line 755 of file ipv6/route.c.

References end_bh_atomic(), ESRCH, fib6_locate(), fn, ip6_del_rt(), ip6_routing_table, NULL, RTF_GATEWAY, in6_rtmsg::rtmsg_dst, in6_rtmsg::rtmsg_dst_len, in6_rtmsg::rtmsg_flags, in6_rtmsg::rtmsg_gateway, in6_rtmsg::rtmsg_ifindex, in6_rtmsg::rtmsg_metric, in6_rtmsg::rtmsg_src, in6_rtmsg::rtmsg_src_len, and start_bh_atomic().

Referenced by ipv6_route_ioctl().

Here is the call graph for this function:

void ip6_route_input struct sk_buff skb  ) 
 

Definition at line 361 of file ipv6/route.c.

References atomic_inc, BACKTRACK, sk_buff::dev, sk_buff::dst, fib6_lookup(), fn, ip6_routing_table, ip6_rt_policy, IPV6_ADDR_LINKLOCAL, IPV6_ADDR_MULTICAST, ipv6_addr_type(), jiffies, sk_buff::nh, out, rt6_cow(), rt6_device_match(), RTF_CACHE, RTF_FLOW, and RTF_NONEXTHOP.

Referenced by ipv6_rcv(), and ipv6_routing_header().

Here is the call graph for this function:

struct dst_entry* ip6_route_output struct sock sk,
struct flowi fl
 

Definition at line 422 of file ipv6/route.c.

References atomic_inc, BACKTRACK, end_bh_atomic(), fib6_lookup(), fn, ip6_routing_table, ip6_rt_policy, IP6_RT_PRIO_ADDRCONF, IPV6_ADDR_LINKLOCAL, IPV6_ADDR_MULTICAST, ipv6_addr_type(), jiffies, flowi::nl_u, flowi::oif, out, rt6_best_dflt(), rt6_cow(), rt6_device_match(), RTF_CACHE, RTF_DEFAULT, RTF_FLOW, RTF_NONEXTHOP, and start_bh_atomic().

Referenced by icmpv6_xrlim_allow(), ip6_build_xmit(), tcp_v6_connect(), tcp_v6_err(), tcp_v6_rebuild_header(), tcp_v6_send_ack(), tcp_v6_send_reset(), tcp_v6_send_synack(), tcp_v6_syn_recv_sock(), tcp_v6_xmit(), and udpv6_connect().

Here is the call graph for this function:

int ip6_rt_addr_add struct in6_addr addr,
struct device *  dev
 

Definition at line 1214 of file ipv6/route.c.

References dev_get(), dst_alloc(), ENOMEM, ip6_input(), ip6_output(), ipv6_get_hoplimit(), ipv6_get_mtu(), NULL, rt6_ins(), RTF_NONEXTHOP, RTF_UP, and TCP_TIMEOUT_INIT.

Referenced by ipv6_ifa_notify().

Here is the call graph for this function:

int ip6_rt_addr_del struct in6_addr addr,
struct device *  dev
 

Definition at line 1248 of file ipv6/route.c.

References ENOENT, ip6_del_rt(), loopback_dev, NULL, and rt6_lookup().

Referenced by ipv6_ifa_notify().

Here is the call graph for this function:

static struct rt6_info * ip6_rt_copy struct rt6_info *  ort  )  [static]
 

Definition at line 1071 of file ipv6/route.c.

References dst_alloc(), jiffies, memcpy, and RTF_EXPIRES.

Referenced by ip6_fw_dup(), rt6_cow(), rt6_pmtu_discovery(), and rt6_redirect().

Here is the call graph for this function:

static int ipv6_get_hoplimit struct device *  dev  )  [static]
 

Definition at line 595 of file ipv6/route.c.

References ipv6_devconf, and ipv6_get_idev().

Referenced by ip6_route_add(), ip6_rt_addr_add(), and rt6_redirect().

Here is the call graph for this function:

static int ipv6_get_mtu struct device *  dev  )  [static]
 

Definition at line 584 of file ipv6/route.c.

References ipv6_get_idev(), and IPV6_MIN_MTU.

Referenced by ip6_route_add(), ip6_rt_addr_add(), and rt6_redirect().

Here is the call graph for this function:

int ipv6_route_ioctl unsigned int  cmd,
void *  arg
 

Definition at line 1159 of file ipv6/route.c.

References CAP_NET_ADMIN, capable, copy_from_user, EFAULT, EINVAL, EPERM, ip6_route_add(), ip6_route_del(), RDBG, rtnl_lock(), rtnl_unlock(), SIOCADDRT, and SIOCDELRT.

Referenced by inet6_ioctl().

Here is the call graph for this function:

static void ipv6_wash_prefix struct in6_addr pfx,
int  plen
[static]
 

Definition at line 573 of file ipv6/route.c.

References b, memset, and o.

Referenced by ip6_route_add().

struct rt6_info* rt6_add_dflt_router struct in6_addr gwaddr,
struct device *  dev
 

Definition at line 1121 of file ipv6/route.c.

References ip6_route_add(), memset, rt6_get_dflt_router(), RTF_ADDRCONF, RTF_DEFAULT, RTF_GATEWAY, RTF_UP, in6_rtmsg::rtmsg_flags, in6_rtmsg::rtmsg_gateway, in6_rtmsg::rtmsg_ifindex, in6_rtmsg::rtmsg_metric, RTMSG_NEWROUTE, and in6_rtmsg::rtmsg_type.

Referenced by ndisc_router_discovery().

Here is the call graph for this function:

static struct rt6_info* rt6_best_dflt struct rt6_info *  rt,
int  oif
[static]
 

Definition at line 170 of file ipv6/route.c.

References m, match, next, NUD_DELAY, NUD_REACHABLE, NUD_STALE, NULL, out, RDBG, and rt6_dflt_pointer.

Referenced by ip6_route_output().

static struct rt6_info* rt6_cow struct rt6_info *  ort,
struct in6_addr daddr,
struct in6_addr saddr
[static]
 

Definition at line 275 of file ipv6/route.c.

References ip6_null_entry, ip6_rt_copy(), rt6_ins(), RTF_CACHE, and RTF_GATEWAY.

Referenced by ip6_route_input(), ip6_route_output(), and rt6_pmtu_discovery().

Here is the call graph for this function:

static __inline__ struct rt6_info* rt6_device_match struct rt6_info *  rt,
int  oif,
int  strict
[static]
 

Definition at line 140 of file ipv6/route.c.

References dev, device, IFF_LOOPBACK, ip6_null_entry, local, and NULL.

Referenced by ip6_route_input(), ip6_route_output(), and rt6_lookup().

struct rt6_info* rt6_get_dflt_router struct in6_addr addr,
struct device *  dev
 

Definition at line 1102 of file ipv6/route.c.

References end_bh_atomic(), fn, ip6_routing_table, and start_bh_atomic().

Referenced by ndisc_rcv(), ndisc_router_discovery(), and rt6_add_dflt_router().

Here is the call graph for this function:

void rt6_ifdown struct device *  dev  ) 
 

Definition at line 1388 of file ipv6/route.c.

References fib6_clean_tree(), fib6_ifdown(), and ip6_routing_table.

Referenced by addrconf_ifdown().

Here is the call graph for this function:

static int rt6_ins struct rt6_info *  rt  )  [static]
 

Definition at line 264 of file ipv6/route.c.

References end_bh_atomic(), fib6_add(), ip6_routing_table, and start_bh_atomic().

Referenced by ip6_route_add(), ip6_rt_addr_add(), rt6_cow(), rt6_pmtu_discovery(), and rt6_redirect().

Here is the call graph for this function:

struct rt6_info* rt6_lookup struct in6_addr daddr,
struct in6_addr saddr,
int  oif,
int  strict
 

Definition at line 244 of file ipv6/route.c.

References atomic_inc, end_bh_atomic(), fib6_lookup(), fn, ip6_routing_table, jiffies, NULL, rt6_device_match(), and start_bh_atomic().

Referenced by addrconf_prefix_rcv(), ip6_route_add(), ip6_rt_addr_del(), ipip6_err(), ipv6_sock_mc_join(), ndisc_send_redirect(), rt6_pmtu_discovery(), and rt6_redirect().

Here is the call graph for this function:

void rt6_mtu_change struct device *  dev,
unsigned  mtu
 

Definition at line 1414 of file ipv6/route.c.

References rt6_mtu_change_arg::dev, fib6_clean_tree(), ip6_routing_table, rt6_mtu_change_arg::mtu, and rt6_mtu_change_route().

Referenced by addrconf_notify(), and ndisc_router_discovery().

Here is the call graph for this function:

static int rt6_mtu_change_route struct rt6_info *  rt,
void *  p_arg
[static]
 

Definition at line 1399 of file ipv6/route.c.

References rt6_mtu_change_arg::dev, rt6_mtu_change_arg::mtu, and RTAX_MTU.

Referenced by rt6_mtu_change().

void rt6_pmtu_discovery struct in6_addr daddr,
struct in6_addr saddr,
struct device *  dev,
u32  pmtu
 

Definition at line 999 of file ipv6/route.c.

References ip6_rt_copy(), ip6_rt_mtu_expires, IPV6_MIN_MTU, KERN_DEBUG, net_ratelimit(), NULL, out, printk, rt6_cow(), rt6_ins(), rt6_lookup(), RTF_CACHE, RTF_DYNAMIC, RTF_EXPIRES, RTF_MODIFIED, and RTF_NONEXTHOP.

Referenced by icmpv6_rcv().

Here is the call graph for this function:

void rt6_purge_dflt_routers int  last_resort  ) 
 

Definition at line 1138 of file ipv6/route.c.

References ip6_del_rt(), ip6_routing_table, NULL, rt6_dflt_pointer, RTF_ADDRCONF, RTF_ALLONLINK, RTF_DEFAULT, and u32.

Referenced by ndisc_router_discovery().

Here is the call graph for this function:

void rt6_redirect struct in6_addr dest,
struct in6_addr saddr,
struct neighbour *  neigh,
int  on_link
 

Definition at line 889 of file ipv6/route.c.

References ip6_del_rt(), ip6_routing_table, ip6_rt_copy(), ipv6_get_hoplimit(), ipv6_get_mtu(), KERN_DEBUG, net_ratelimit(), NULL, out, printk, rt6_ins(), rt6_lookup(), RTF_CACHE, RTF_DEFAULT, RTF_DYNAMIC, RTF_GATEWAY, and RTF_UP.

Referenced by ndisc_redirect_rcv().

Here is the call graph for this function: