diff options
author | bz <bz@FreeBSD.org> | 2005-06-28 06:55:45 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2005-06-28 06:55:45 +0000 |
commit | 784fd39252ebfb6e8afa16b88610611b686ff2ec (patch) | |
tree | 11f8d63495911674ae48fb598963fa1c850c703e /sys/net/if_gre.c | |
parent | da4b6d5ff87f5ab9289195dec6a1425a6972ec9e (diff) | |
download | FreeBSD-src-784fd39252ebfb6e8afa16b88610611b686ff2ec.zip FreeBSD-src-784fd39252ebfb6e8afa16b88610611b686ff2ec.tar.gz |
Fix panic after ifnet changes in rev. 1.30. sc->sc_ifp is a
pointer now and needs to be allocated before using.
Reviewed by: gnn
Approved by: re (scottl), rwatson (mentor)
Diffstat (limited to 'sys/net/if_gre.c')
-rw-r--r-- | sys/net/if_gre.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index eae1f16..90f54c9 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -169,10 +169,16 @@ gre_clone_create(ifc, unit) sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO); - if_initname(GRE2IFP(sc), ifc->ifc_name, unit); + GRE2IFP(sc) = if_alloc(IFT_TUNNEL); + if (GRE2IFP(sc) == NULL) { + free(sc, M_GRE); + return (ENOSPC); + } + GRE2IFP(sc)->if_softc = sc; + if_initname(GRE2IFP(sc), ifc->ifc_name, unit); + GRE2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; - GRE2IFP(sc)->if_type = IFT_TUNNEL; GRE2IFP(sc)->if_addrlen = 0; GRE2IFP(sc)->if_hdrlen = 24; /* IP + GRE */ GRE2IFP(sc)->if_mtu = GREMTU; |