if_gre.c (106939) | if_gre.c (109623) |
---|---|
1/* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */ | 1/* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */ |
2/* $FreeBSD: head/sys/net/if_gre.c 106939 2002-11-15 00:00:15Z sam $ */ | 2/* $FreeBSD: head/sys/net/if_gre.c 109623 2003-01-21 08:56:16Z alfred $ */ |
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 * --- 144 unchanged lines hidden (view full) --- 155 156static int 157gre_clone_create(ifc, unit) 158 struct if_clone *ifc; 159 int unit; 160{ 161 struct gre_softc *sc; 162 | 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 * --- 144 unchanged lines hidden (view full) --- 155 156static int 157gre_clone_create(ifc, unit) 158 struct if_clone *ifc; 159 int unit; 160{ 161 struct gre_softc *sc; 162 |
163 sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK); | 163 sc = malloc(sizeof(struct gre_softc), M_GRE, 0); |
164 memset(sc, 0, sizeof(struct gre_softc)); 165 166 sc->sc_if.if_name = GRENAME; 167 sc->sc_if.if_softc = sc; 168 sc->sc_if.if_unit = unit; 169 sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN; 170 sc->sc_if.if_type = IFT_OTHER; 171 sc->sc_if.if_addrlen = 0; --- 117 unchanged lines hidden (view full) --- 289 ip->ip_src.s_addr = sc->g_src.s_addr; 290 msiz = MOB_H_SIZ_L; 291 } 292 mob_h.proto = htons(mob_h.proto); 293 mob_h.hcrc = gre_in_cksum((u_short *)&mob_h, msiz); 294 295 if ((m->m_data - msiz) < m->m_pktdat) { 296 /* need new mbuf */ | 164 memset(sc, 0, sizeof(struct gre_softc)); 165 166 sc->sc_if.if_name = GRENAME; 167 sc->sc_if.if_softc = sc; 168 sc->sc_if.if_unit = unit; 169 sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN; 170 sc->sc_if.if_type = IFT_OTHER; 171 sc->sc_if.if_addrlen = 0; --- 117 unchanged lines hidden (view full) --- 289 ip->ip_src.s_addr = sc->g_src.s_addr; 290 msiz = MOB_H_SIZ_L; 291 } 292 mob_h.proto = htons(mob_h.proto); 293 mob_h.hcrc = gre_in_cksum((u_short *)&mob_h, msiz); 294 295 if ((m->m_data - msiz) < m->m_pktdat) { 296 /* need new mbuf */ |
297 MGETHDR(m0, M_DONTWAIT, MT_HEADER); | 297 MGETHDR(m0, M_NOWAIT, MT_HEADER); |
298 if (m0 == NULL) { 299 _IF_DROP(&ifp->if_snd); 300 m_freem(m); 301 error = ENOBUFS; 302 goto end; 303 } 304 m0->m_next = m; 305 m->m_data += sizeof(struct ip); --- 37 unchanged lines hidden (view full) --- 343 break; 344#endif 345 default: 346 _IF_DROP(&ifp->if_snd); 347 m_freem(m); 348 error = EAFNOSUPPORT; 349 goto end; 350 } | 298 if (m0 == NULL) { 299 _IF_DROP(&ifp->if_snd); 300 m_freem(m); 301 error = ENOBUFS; 302 goto end; 303 } 304 m0->m_next = m; 305 m->m_data += sizeof(struct ip); --- 37 unchanged lines hidden (view full) --- 343 break; 344#endif 345 default: 346 _IF_DROP(&ifp->if_snd); 347 m_freem(m); 348 error = EAFNOSUPPORT; 349 goto end; 350 } |
351 M_PREPEND(m, sizeof(struct greip), M_DONTWAIT); | 351 M_PREPEND(m, sizeof(struct greip), M_NOWAIT); |
352 } else { 353 _IF_DROP(&ifp->if_snd); 354 m_freem(m); 355 error = EINVAL; 356 goto end; 357 } 358 359 if (m == NULL) { /* impossible */ --- 397 unchanged lines hidden --- | 352 } else { 353 _IF_DROP(&ifp->if_snd); 354 m_freem(m); 355 error = EINVAL; 356 goto end; 357 } 358 359 if (m == NULL) { /* impossible */ --- 397 unchanged lines hidden --- |