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)
This commit is contained in:
Bjoern A. Zeeb 2005-06-28 06:55:45 +00:00
parent 67c7ede6d2
commit 066b192e3b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147643

View File

@ -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;