Module Name: src
Committed By: knakahara
Date: Wed Nov 11 02:57:17 UTC 2015
Modified Files:
src/sys/net: if_gif.c
Log Message:
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)
====================
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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.90 src/sys/net/if_gif.c:1.91
--- src/sys/net/if_gif.c:1.90 Tue Nov 10 18:22:46 2015
+++ src/sys/net/if_gif.c Wed Nov 11 02:57:17 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gif.c,v 1.90 2015/11/10 18:22:46 christos Exp $ */
+/* $NetBSD: if_gif.c,v 1.91 2015/11/11 02:57:17 knakahara 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.90 2015/11/10 18:22:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.91 2015/11/11 02:57:17 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -678,7 +678,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) */
@@ -747,9 +748,8 @@ gif_set_tunnel(struct ifnet *ifp, struct
sockaddr_free(odst);
ifp->if_flags |= IFF_RUNNING;
- splx(s);
-
- return 0;
+ error = 0;
+ goto out;
rollback:
if (sc->gif_psrc != NULL)
@@ -758,7 +758,7 @@ 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;
@@ -768,8 +768,8 @@ bad:
ifp->if_flags |= IFF_RUNNING;
else
ifp->if_flags &= ~IFF_RUNNING;
+out:
splx(s);
-
return error;
}