Module Name: src Committed By: msaitoh Date: Wed Nov 18 07:41:57 UTC 2015
Modified Files: src/sys/net [netbsd-6-0]: if_gif.c Log Message: Pull up following revision(s) (requested by knakahara in ticket #1345): 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.80.14.1 -r1.80.14.2 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.80.14.1 src/sys/net/if_gif.c:1.80.14.2 --- src/sys/net/if_gif.c:1.80.14.1 Wed Nov 18 07:36:22 2015 +++ src/sys/net/if_gif.c Wed Nov 18 07:41:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gif.c,v 1.80.14.1 2015/11/18 07:36:22 msaitoh Exp $ */ +/* $NetBSD: if_gif.c,v 1.80.14.2 2015/11/18 07:41:57 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.80.14.1 2015/11/18 07:36:22 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.80.14.2 2015/11/18 07:41:57 msaitoh Exp $"); #include "opt_inet.h" #include "opt_iso.h" @@ -720,7 +720,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) */ @@ -788,10 +789,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) @@ -800,18 +799,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; }