示例#1
0
/*
 * De-encapsulate a packet and feed it back through ip input (this
 * routine is called whenever IP gets a packet with proto type
 * IPPROTO_GRE and a local destination address).
 * This really is simple
 */
void
gre_input(struct mbuf *m, int off)
{
	int proto;

	proto = (mtod(m, struct ip *))->ip_p;

	m = gre_input2(m, off, proto);

	/*
	 * If no matching tunnel that is up is found. We inject
	 * the mbuf to raw ip socket to see if anyone picks it up.
	 */
	if (m != NULL)
		rip_input(m, off);
}
示例#2
0
/*
 * De-encapsulate a packet and feed it back through ip input (this
 * routine is called whenever IP gets a packet with proto type
 * IPPROTO_GRE and a local destination address).
 * This really is simple
 */
int
gre_input(struct mbuf **mp, int *offp, int proto)
{
	struct mbuf *m;
	int ret, off;

	off = *offp;
	m = *mp;
	*mp = NULL;

	proto = (mtod(m, struct ip *))->ip_p;

	ret = gre_input2(m, off, proto);
	/*
	 * ret == 0 : packet not processed, meaning that
	 * no matching tunnel that is up is found.
	 * we inject it to raw ip socket to see if anyone picks it up.
	 */
	if (ret == 0) {
		*mp = m;
		rip_input(mp, offp, proto);
	}
	return(IPPROTO_DONE);
}