Module Name: src Committed By: msaitoh Date: Wed Nov 18 08:29:21 UTC 2015
Modified Files: src/sys/net [netbsd-7]: if_gif.c Log Message: Pull up following revision(s) (requested by knakahara in ticket #1034): sys/net/if_gif.c: revision 1.91 sys/net/if_gif.c: revision 1.92 fix panic after "ifconfig gifX tunnel src dst" failed for the reason of address pair duplication. e.g. ==================== # ifconfig gif0 create # ifconfig gif0 tunnel 192.168.0.1 192.168.0.2 # ifconfig gif0 inet 172.16.0.1/24 172.16.0.2 # route add 10.1.0.0/24 172.16.0.1 # ifconfig gif1 create # ifconfig gif1 tunnel 192.168.0.1 192.168.0.3 # ifconfig gif0 tunnel 192.168.0.1 192.168.0.3 ifconfig: SIOCSLIFPHYADDR: Can't assign requested address # expected # ping 10.1.0.1 (panic) ==================== fix CID 980463 To generate a diff of this commit: cvs rdiff -u -r1.83.2.2 -r1.83.2.3 src/sys/net/if_gif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_gif.c diff -u src/sys/net/if_gif.c:1.83.2.2 src/sys/net/if_gif.c:1.83.2.3 --- src/sys/net/if_gif.c:1.83.2.2 Wed Nov 18 08:21:52 2015 +++ src/sys/net/if_gif.c Wed Nov 18 08:29:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gif.c,v 1.83.2.2 2015/11/18 08:21:52 msaitoh Exp $ */ +/* $NetBSD: if_gif.c,v 1.83.2.3 2015/11/18 08:29:21 msaitoh Exp $ */ /* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.83.2.2 2015/11/18 08:21:52 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.83.2.3 2015/11/18 08:29:21 msaitoh Exp $"); #include "opt_inet.h" @@ -674,7 +674,8 @@ gif_set_tunnel(struct ifnet *ifp, struct if (sockaddr_cmp(sc2->gif_pdst, dst) == 0 && sockaddr_cmp(sc2->gif_psrc, src) == 0) { error = EADDRNOTAVAIL; - goto bad; + /* continue to use the old configureation. */ + goto out; } /* XXX both end must be valid? (I mean, not 0.0.0.0) */ @@ -742,10 +743,8 @@ gif_set_tunnel(struct ifnet *ifp, struct if (odst) sockaddr_free(odst); - ifp->if_flags |= IFF_RUNNING; - splx(s); - - return 0; + error = 0; + goto out; rollback: if (sc->gif_psrc != NULL) @@ -754,18 +753,19 @@ rollback: sockaddr_free(sc->gif_pdst); sc->gif_psrc = osrc; sc->gif_pdst = odst; -bad: + if (sc->gif_si) { softint_disestablish(sc->gif_si); sc->gif_si = NULL; } +out: if (sc->gif_psrc && sc->gif_pdst) ifp->if_flags |= IFF_RUNNING; else ifp->if_flags &= ~IFF_RUNNING; - splx(s); + splx(s); return error; }