Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net fix panic after "ifconfig gifX tunnel src dst" faile...



details:   https://anonhg.NetBSD.org/src/rev/b9693d1f92bc
branches:  trunk
changeset: 341542:b9693d1f92bc
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Wed Nov 11 02:57:17 2015 +0000

description:
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)
    ====================

diffstat:

 sys/net/if_gif.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (59 lines):

diff -r 6c4fe9605d4e -r b9693d1f92bc sys/net/if_gif.c
--- a/sys/net/if_gif.c  Wed Nov 11 02:43:09 2015 +0000
+++ b/sys/net/if_gif.c  Wed Nov 11 02:57:17 2015 +0000
@@ -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 @@
                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 @@
                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 @@
                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 @@
                ifp->if_flags |= IFF_RUNNING;
        else
                ifp->if_flags &= ~IFF_RUNNING;
+out:
        splx(s);
-
        return error;
 }
 



Home | Main Index | Thread Index | Old Index