if_stf.c (8071913df2dce4a8c721eeecb338c9fb7d0f8485) if_stf.c (1ed4b9feffa89982972b435d96b71475ec251941)
1/* $FreeBSD$ */
2/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
3
4/*
5 * Copyright (C) 2000 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

187 *unit = rman_get_start(r);
188 } else {
189 r = rman_reserve_resource(stfunits, *unit, *unit, 1,
190 RF_ALLOCATED | RF_ACTIVE, NULL);
191 if (r == NULL)
192 return (EEXIST);
193 }
194
1/* $FreeBSD$ */
2/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
3
4/*
5 * Copyright (C) 2000 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

187 *unit = rman_get_start(r);
188 } else {
189 r = rman_reserve_resource(stfunits, *unit, *unit, 1,
190 RF_ALLOCATED | RF_ACTIVE, NULL);
191 if (r == NULL)
192 return (EEXIST);
193 }
194
195 sc = malloc(sizeof(struct stf_softc), M_STF, M_WAIT);
196 bzero(sc, sizeof(struct stf_softc));
197
195 sc = malloc(sizeof(struct stf_softc), M_STF, M_WAITOK | M_ZERO);
198 sc->sc_if.if_name = STFNAME;
199 sc->sc_if.if_unit = *unit;
200 sc->r_unit = r;
201
202 sc->encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV6,
203 stf_encapcheck, &in_stf_protosw, sc);
204 if (sc->encap_cookie == NULL) {
205 printf("%s: attach failed\n", if_name(&sc->sc_if));
206 free(sc, M_STF);
207 return (ENOMEM);
208 }
209
210 sc->sc_if.if_mtu = IPV6_MMTU;
196 sc->sc_if.if_name = STFNAME;
197 sc->sc_if.if_unit = *unit;
198 sc->r_unit = r;
199
200 sc->encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV6,
201 stf_encapcheck, &in_stf_protosw, sc);
202 if (sc->encap_cookie == NULL) {
203 printf("%s: attach failed\n", if_name(&sc->sc_if));
204 free(sc, M_STF);
205 return (ENOMEM);
206 }
207
208 sc->sc_if.if_mtu = IPV6_MMTU;
211 sc->sc_if.if_flags = 0;
212 sc->sc_if.if_ioctl = stf_ioctl;
213 sc->sc_if.if_output = stf_output;
214 sc->sc_if.if_type = IFT_STF;
215 sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
216 if_attach(&sc->sc_if);
217 bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
218 LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list);
219 return (0);

--- 542 unchanged lines hidden ---
209 sc->sc_if.if_ioctl = stf_ioctl;
210 sc->sc_if.if_output = stf_output;
211 sc->sc_if.if_type = IFT_STF;
212 sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
213 if_attach(&sc->sc_if);
214 bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
215 LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list);
216 return (0);

--- 542 unchanged lines hidden ---