Deleted Added
full compact
if_gre.c (179894) if_gre.c (180041)
1/* $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $ */
1/* $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $ */
2/* $FreeBSD: head/sys/net/if_gre.c 179894 2008-06-20 17:26:34Z thompsa $ */
2/* $FreeBSD: head/sys/net/if_gre.c 180041 2008-06-26 22:59:49Z julian $ */
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *

--- 229 unchanged lines hidden (view full) ---

240static int
241gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
242 struct rtentry *rt)
243{
244 int error = 0;
245 struct gre_softc *sc = ifp->if_softc;
246 struct greip *gh;
247 struct ip *ip;
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Heiko W.Rupp <hwr@pilhuhn.de>
10 *

--- 229 unchanged lines hidden (view full) ---

240static int
241gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
242 struct rtentry *rt)
243{
244 int error = 0;
245 struct gre_softc *sc = ifp->if_softc;
246 struct greip *gh;
247 struct ip *ip;
248 u_short ip_id = 0;
249 uint8_t ip_tos = 0;
248 u_short gre_ip_id = 0;
249 uint8_t gre_ip_tos = 0;
250 u_int16_t etype = 0;
251 struct mobile_h mob_h;
252 u_int32_t af;
253
254 /*
255 * gre may cause infinite recursion calls when misconfigured.
256 * We'll prevent this by introducing upper limit.
257 */

--- 100 unchanged lines hidden (view full) ---

358 m_freem(m);
359 error = EINVAL;
360 goto end;
361 }
362 } else if (sc->g_proto == IPPROTO_GRE) {
363 switch (dst->sa_family) {
364 case AF_INET:
365 ip = mtod(m, struct ip *);
250 u_int16_t etype = 0;
251 struct mobile_h mob_h;
252 u_int32_t af;
253
254 /*
255 * gre may cause infinite recursion calls when misconfigured.
256 * We'll prevent this by introducing upper limit.
257 */

--- 100 unchanged lines hidden (view full) ---

358 m_freem(m);
359 error = EINVAL;
360 goto end;
361 }
362 } else if (sc->g_proto == IPPROTO_GRE) {
363 switch (dst->sa_family) {
364 case AF_INET:
365 ip = mtod(m, struct ip *);
366 ip_tos = ip->ip_tos;
367 ip_id = ip->ip_id;
366 gre_ip_tos = ip->ip_tos;
367 gre_ip_id = ip->ip_id;
368 etype = ETHERTYPE_IP;
369 break;
370#ifdef INET6
371 case AF_INET6:
368 etype = ETHERTYPE_IP;
369 break;
370#ifdef INET6
371 case AF_INET6:
372 ip_id = ip_newid();
372 gre_ip_id = ip_newid();
373 etype = ETHERTYPE_IPV6;
374 break;
375#endif
376#ifdef NETATALK
377 case AF_APPLETALK:
378 etype = ETHERTYPE_ATALK;
379 break;
380#endif

--- 42 unchanged lines hidden (view full) ---

423
424 gh->gi_pr = sc->g_proto;
425 if (sc->g_proto != IPPROTO_MOBILE) {
426 gh->gi_src = sc->g_src;
427 gh->gi_dst = sc->g_dst;
428 ((struct ip*)gh)->ip_v = IPPROTO_IPV4;
429 ((struct ip*)gh)->ip_hl = (sizeof(struct ip)) >> 2;
430 ((struct ip*)gh)->ip_ttl = GRE_TTL;
373 etype = ETHERTYPE_IPV6;
374 break;
375#endif
376#ifdef NETATALK
377 case AF_APPLETALK:
378 etype = ETHERTYPE_ATALK;
379 break;
380#endif

--- 42 unchanged lines hidden (view full) ---

423
424 gh->gi_pr = sc->g_proto;
425 if (sc->g_proto != IPPROTO_MOBILE) {
426 gh->gi_src = sc->g_src;
427 gh->gi_dst = sc->g_dst;
428 ((struct ip*)gh)->ip_v = IPPROTO_IPV4;
429 ((struct ip*)gh)->ip_hl = (sizeof(struct ip)) >> 2;
430 ((struct ip*)gh)->ip_ttl = GRE_TTL;
431 ((struct ip*)gh)->ip_tos = ip_tos;
432 ((struct ip*)gh)->ip_id = ip_id;
431 ((struct ip*)gh)->ip_tos = gre_ip_tos;
432 ((struct ip*)gh)->ip_id = gre_ip_id;
433 gh->gi_len = m->m_pkthdr.len;
434 }
435
436 ifp->if_opackets++;
437 ifp->if_obytes += m->m_pkthdr.len;
438 /*
439 * Send it off and with IP_FORWARD flag to prevent it from
440 * overwriting the ip_id again. ip_id is already set to the

--- 460 unchanged lines hidden ---
433 gh->gi_len = m->m_pkthdr.len;
434 }
435
436 ifp->if_opackets++;
437 ifp->if_obytes += m->m_pkthdr.len;
438 /*
439 * Send it off and with IP_FORWARD flag to prevent it from
440 * overwriting the ip_id again. ip_id is already set to the

--- 460 unchanged lines hidden ---