goto done;
}
- sc = _MALLOC(sizeof (struct gif_softc), M_DEVBUF, M_WAITOK);
+ sc = _MALLOC(sizeof (struct gif_softc), M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL) {
log(LOG_ERR, "gif_clone_create: failed to allocate gif%d\n",
unit);
error = ENOBUFS;
goto done;
}
- bzero(sc, sizeof (struct gif_softc));
/* use the interface name as the unique id for ifp recycle */
snprintf(sc->gif_ifname, sizeof (sc->gif_ifname), "%s%d",
#endif
default:
error = ENETDOWN;
- goto end;
+ break;
}
-end:
GIF_UNLOCK(sc);
+end:
if (error) {
/* the mbuf was freed either by in_gif_output or in here */
ifnet_stat_increment_out(ifp, 0, 0, 1);
case SIOCSIFPHYADDR_IN6_32:
case SIOCSIFPHYADDR_IN6_64:
#endif /* INET6 */
- case SIOCSLIFPHYADDR:
switch (cmd) {
#if INET
case SIOCSIFPHYADDR:
break;
}
#endif
- case SIOCSLIFPHYADDR:
- src = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->addr);
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->dstaddr);
}
/* sa_family must be equal */
break;
return (EAFNOSUPPORT);
#endif /* INET6 */
- case SIOCSLIFPHYADDR:
- /* checks done in the above */
- break;
}
#define GIF_ORDERED_LOCK(sc, sc2) \
GIF_UNLOCK(sc);
break;
- case SIOCGLIFPHYADDR:
- GIF_LOCK(sc);
- if (sc->gif_psrc == NULL || sc->gif_pdst == NULL) {
- GIF_UNLOCK(sc);
- error = EADDRNOTAVAIL;
- goto bad;
- }
-
- /* copy src */
- src = sc->gif_psrc;
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->addr);
- size = sizeof (((struct if_laddrreq *)data)->addr);
- if (src->sa_len > size) {
- GIF_UNLOCK(sc);
- return (EINVAL);
- }
- bcopy((caddr_t)src, (caddr_t)dst, src->sa_len);
-
- /* copy dst */
- src = sc->gif_pdst;
- dst = (struct sockaddr *)
- &(((struct if_laddrreq *)data)->dstaddr);
- size = sizeof (((struct if_laddrreq *)data)->dstaddr);
- if (src->sa_len > size) {
- GIF_UNLOCK(sc);
- return (EINVAL);
- }
- bcopy((caddr_t)src, (caddr_t)dst, src->sa_len);
- GIF_UNLOCK(sc);
- break;
-
case SIOCSIFFLAGS:
/* if_ioctl() takes care of it */
break;