1/* $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $ */ |
2/* $FreeBSD: head/sys/net/if_gre.c 128580 2004-04-23 16:10:23Z andre $ */ |
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 * --- 343 unchanged lines hidden (view full) --- 354 M_PREPEND(m, sizeof(struct greip), M_DONTWAIT); 355 } else { 356 _IF_DROP(&ifp->if_snd); 357 m_freem(m); 358 error = EINVAL; 359 goto end; 360 } 361 |
362 if (m == NULL) { /* mbuf allocation failed */ |
363 _IF_DROP(&ifp->if_snd); 364 error = ENOBUFS; 365 goto end; 366 } 367 368 gh = mtod(m, struct greip *); 369 if (sc->g_proto == IPPROTO_GRE) { 370 /* we don't have any GRE flags for now */ --- 10 unchanged lines hidden (view full) --- 381 ((struct ip*)gh)->ip_tos = ip->ip_tos; 382 ((struct ip*)gh)->ip_id = ip->ip_id; 383 gh->gi_len = m->m_pkthdr.len; 384 } 385 386 ifp->if_opackets++; 387 ifp->if_obytes += m->m_pkthdr.len; 388 /* send it off */ |
389 error = ip_output(m, NULL, &sc->route, IP_FORWARDING, |
390 (struct ip_moptions *)NULL, (struct inpcb *)NULL); 391 end: 392 sc->called = 0; 393 if (error) 394 ifp->if_oerrors++; 395 return (error); 396} 397 --- 380 unchanged lines hidden --- |