Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70ceb4f5 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller
Browse files

[IPV6]: ROUTE: Add experimental support for Route Information Option in RA (RFC4191).

parent 52e16356
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
#define RTF_NONEXTHOP	0x00200000	/* route with no nexthop	*/
#define RTF_EXPIRES	0x00400000

#define RTF_ROUTEINFO	0x00800000	/* route information - RA	*/

#define RTF_CACHE	0x01000000	/* cache entry			*/
#define RTF_FLOW	0x02000000	/* flow significant route	*/
#define RTF_POLICY	0x04000000	/* policy route			*/
+21 −0
Original line number Diff line number Diff line
@@ -7,6 +7,23 @@
#define IP6_RT_PRIO_KERN	512
#define IP6_RT_FLOW_MASK	0x00ff

struct route_info {
	__u8			type;
	__u8			length;
	__u8			prefix_len;
#if defined(__BIG_ENDIAN_BITFIELD)
	__u8			reserved_h:3,
				route_pref:2,
				reserved_l:3;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
	__u8			reserved_l:3,
				route_pref:2,
				reserved_h:3;
#endif
	__u32			lifetime;
	__u8			prefix[0];	/* 0,8 or 16 */
};

#ifdef __KERNEL__

#include <net/flow.h>
@@ -92,6 +109,10 @@ extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr,

extern void			rt6_purge_dflt_routers(void);

extern int			rt6_route_rcv(struct net_device *dev,
					      u8 *opt, int len,
					      struct in6_addr *gwaddr);

extern void			rt6_redirect(struct in6_addr *dest,
					     struct in6_addr *saddr,
					     struct neighbour *neigh,
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ enum {
	ND_OPT_PREFIX_INFO = 3,		/* RFC2461 */
	ND_OPT_REDIRECT_HDR = 4,	/* RFC2461 */
	ND_OPT_MTU = 5,			/* RFC2461 */
	__ND_OPT_ARRAY_MAX,
	ND_OPT_ROUTE_INFO = 24,		/* RFC4191 */
	__ND_OPT_MAX
};

+8 −0
Original line number Diff line number Diff line
@@ -49,6 +49,14 @@ config IPV6_ROUTER_PREF

	  If unsure, say N.

config IPV6_ROUTE_INFO
	bool "IPv6: Route Information (RFC 4191) support (EXPERIMENTAL)"
	depends on IPV6_ROUTER_PREF && EXPERIMENTAL
	---help---
	  This is experimental support of Route Information.

	  If unsure, say N.

config INET6_AH
	tristate "IPv6: AH transformation"
	depends on IPV6
+24 −1
Original line number Diff line number Diff line
@@ -156,7 +156,11 @@ struct neigh_table nd_tbl = {

/* ND options */
struct ndisc_options {
	struct nd_opt_hdr *nd_opt_array[__ND_OPT_MAX];
	struct nd_opt_hdr *nd_opt_array[__ND_OPT_ARRAY_MAX];
#ifdef CONFIG_IPV6_ROUTE_INFO
	struct nd_opt_hdr *nd_opts_ri;
	struct nd_opt_hdr *nd_opts_ri_end;
#endif
};

#define nd_opts_src_lladdr	nd_opt_array[ND_OPT_SOURCE_LL_ADDR]
@@ -255,6 +259,13 @@ static struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
			if (ndopts->nd_opt_array[nd_opt->nd_opt_type] == 0)
				ndopts->nd_opt_array[nd_opt->nd_opt_type] = nd_opt;
			break;
#ifdef CONFIG_IPV6_ROUTE_INFO
		case ND_OPT_ROUTE_INFO:
			ndopts->nd_opts_ri_end = nd_opt;
			if (!ndopts->nd_opts_ri)
				ndopts->nd_opts_ri = nd_opt;
			break;
#endif
		default:
			/*
			 * Unknown options must be silently ignored,
@@ -1202,6 +1213,18 @@ static void ndisc_router_discovery(struct sk_buff *skb)
			     NEIGH_UPDATE_F_ISROUTER);
	}

#ifdef CONFIG_IPV6_ROUTE_INFO
	if (ndopts.nd_opts_ri) {
		struct nd_opt_hdr *p;
		for (p = ndopts.nd_opts_ri;
		     p;
		     p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) {
			rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
				      &skb->nh.ipv6h->saddr);
		}
	}
#endif

	if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
		struct nd_opt_hdr *p;
		for (p = ndopts.nd_opts_pi;
Loading