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

Commit fadf6bf0 authored by Templin, Fred L's avatar Templin, Fred L Committed by YOSHIFUJI Hideaki
Browse files

[IPV6] SIT: Add PRL management for ISATAP.



This patch updates the Linux the Intra-Site Automatic Tunnel Addressing
Protocol (ISATAP) implementation. It places the ISATAP potential router
list (PRL) in the kernel and adds three new private ioctls for PRL
management.

[Add several changes of structure name, constant names etc. - yoshfuji]

Signed-off-by: default avatarFred L. Templin <fred.l.templin@boeing.com>
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
parent f0bdb7ba
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
#define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
#define SIOCDELTUNNEL   (SIOCDEVPRIVATE + 2)
#define SIOCCHGTUNNEL   (SIOCDEVPRIVATE + 3)
#define SIOCADDPRL      (SIOCDEVPRIVATE + 5)
#define SIOCDELPRL      (SIOCDEVPRIVATE + 6)
#define SIOCCHGPRL      (SIOCDEVPRIVATE + 7)

#define GRE_CSUM	__constant_htons(0x8000)
#define GRE_ROUTING	__constant_htons(0x4000)
@@ -17,9 +20,6 @@
#define GRE_FLAGS	__constant_htons(0x00F8)
#define GRE_VERSION	__constant_htons(0x0007)

/* i_flags values for SIT mode */
#define	SIT_ISATAP	0x0001

struct ip_tunnel_parm
{
	char			name[IFNAMSIZ];
@@ -31,4 +31,16 @@ struct ip_tunnel_parm
	struct iphdr		iph;
};

/* SIT-mode i_flags */
#define	SIT_ISATAP	0x0001

struct ip_tunnel_prl {
	__be32			addr;
	__u16			flags;
	__u16			__reserved;
};

/* PRL flags */
#define	PRL_DEFAULT		0x0001

#endif /* _IF_TUNNEL_H_ */
+2 −1
Original line number Diff line number Diff line
@@ -313,7 +313,8 @@ struct sk_buff {
	__u16			tc_verd;	/* traffic control verdict */
#endif
#endif
	/* 2 byte hole */
	__u8			ndisc_nodetype:2;
	/* 14 bit hole */

#ifdef CONFIG_NET_DMA
	dma_cookie_t		dma_cookie;
+7 −0
Original line number Diff line number Diff line
@@ -24,6 +24,13 @@ struct ip_tunnel
	int			mlink;

	struct ip_tunnel_parm	parms;
	struct ip_tunnel_prl_entry	*prl;		/* potential router list */
};

struct ip_tunnel_prl_entry
{
	struct ip_tunnel_prl_entry	*next;
	struct ip_tunnel_prl		entry;
};

#define IPTUNNEL_XMIT() do {						\
+9 −0
Original line number Diff line number Diff line
@@ -11,6 +11,15 @@
#define NDISC_NEIGHBOUR_ADVERTISEMENT	136
#define NDISC_REDIRECT			137

/*
 * Router type: cross-layer information from link-layer to
 * IPv6 layer reported by certain link types (e.g., RFC4214).
 */
#define NDISC_NODETYPE_UNSPEC		0	/* unspecified (default) */
#define NDISC_NODETYPE_HOST		1	/* host or unauthorized router */
#define NDISC_NODETYPE_NODEFAULT	2	/* non-default router */
#define NDISC_NODETYPE_DEFAULT		3	/* default router */

/*
 *	ndisc options
 */
+24 −0
Original line number Diff line number Diff line
@@ -1092,6 +1092,12 @@ static void ndisc_router_discovery(struct sk_buff *skb)
		return;
	}

	if (skb->ndisc_nodetype == NDISC_NODETYPE_HOST) {
		ND_PRINTK2(KERN_WARNING
			   "ICMPv6 RA: from host or unauthorized router\n");
		return;
	}

	/*
	 *	set the RA_RECV flag in the interface
	 */
@@ -1115,6 +1121,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
		return;
	}

	/* skip link-specific parameters from interior routers */
	if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT)
		goto skip_linkparms;

	if (in6_dev->if_flags & IF_RS_SENT) {
		/*
		 *	flag that an RA was received after an RS was sent
@@ -1229,6 +1239,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
		}
	}

skip_linkparms:

	/*
	 *	Process options.
	 */
@@ -1268,6 +1280,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
	}
#endif

	/* skip link-specific ndopts from interior routers */
	if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT)
		goto out;

	if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
		struct nd_opt_hdr *p;
		for (p = ndopts.nd_opts_pi;
@@ -1331,6 +1347,14 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
	int optlen;
	u8 *lladdr = NULL;

	switch (skb->ndisc_nodetype) {
	case NDISC_NODETYPE_HOST:
	case NDISC_NODETYPE_NODEFAULT:
		ND_PRINTK2(KERN_WARNING
			   "ICMPv6 Redirect: from host or unauthorized router\n");
		return;
	}

	if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
		ND_PRINTK2(KERN_WARNING
			   "ICMPv6 Redirect: source address is not link-local.\n");
Loading