Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by ozaki-r in ti...
details: https://anonhg.NetBSD.org/src/rev/255a478b177e
branches: netbsd-8
changeset: 453779:255a478b177e
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 19 14:27:16 2019 +0000
description:
Pull up following revision(s) (requested by ozaki-r in ticket #1339):
sys/net/if.c: revision 1.458
tests/net/if/t_ifconfig.sh: revision 1.21
Restore if_ioctl on error of ifc_destroy
Otherwise subsequence ioctls won't work.
Patch from Harold Gutch on PR kern/54434 (tweaked a bit by me)
tests: check if ifconfig (ioctl) works after a failure of ifconfig destroy
This is a test for PR kern/54434.
diffstat:
sys/net/if.c | 18 +++++++++++++++---
tests/net/if/t_ifconfig.sh | 7 ++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
diffs (74 lines):
diff -r 682a2e00cb84 -r 255a478b177e sys/net/if.c
--- a/sys/net/if.c Fri Aug 16 15:39:59 2019 +0000
+++ b/sys/net/if.c Mon Aug 19 14:27:16 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.394.2.16 2019/04/19 09:12:58 martin Exp $ */
+/* $NetBSD: if.c,v 1.394.2.17 2019/08/19 14:27:16 martin Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.16 2019/04/19 09:12:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.17 2019/08/19 14:27:16 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1601,6 +1601,8 @@
struct if_clone *ifc;
struct ifnet *ifp;
struct psref psref;
+ int error;
+ int (*if_ioctl)(struct ifnet *, u_long, void *);
KASSERT(mutex_owned(&if_clone_mtx));
@@ -1617,6 +1619,7 @@
/* We have to disable ioctls here */
IFNET_LOCK(ifp);
+ if_ioctl = ifp->if_ioctl;
ifp->if_ioctl = if_nullioctl;
IFNET_UNLOCK(ifp);
@@ -1626,7 +1629,16 @@
*/
if_put(ifp, &psref);
- return (*ifc->ifc_destroy)(ifp);
+ error = (*ifc->ifc_destroy)(ifp);
+
+ if (error != 0) {
+ /* We have to restore if_ioctl on error */
+ IFNET_LOCK(ifp);
+ ifp->if_ioctl = if_ioctl;
+ IFNET_UNLOCK(ifp);
+ }
+
+ return error;
}
static bool
diff -r 682a2e00cb84 -r 255a478b177e tests/net/if/t_ifconfig.sh
--- a/tests/net/if/t_ifconfig.sh Fri Aug 16 15:39:59 2019 +0000
+++ b/tests/net/if/t_ifconfig.sh Mon Aug 19 14:27:16 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.18 2017/03/16 09:43:56 ozaki-r Exp $
+# $NetBSD: t_ifconfig.sh,v 1.18.4.1 2019/08/19 14:27:16 martin Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -69,6 +69,11 @@
atf_check -s exit:0 rump.ifconfig shmif0 up
atf_check -s exit:0 rump.ifconfig shmif0 destroy
+ # Check if ifconfig (ioctl) works after a failure of ifconfig destroy
+ atf_check -s exit:0 -o ignore rump.ifconfig lo0
+ atf_check -s not-exit:0 -e ignore rump.ifconfig lo0 destroy
+ atf_check -s exit:0 -o ignore rump.ifconfig lo0
+
unset RUMP_SERVER
}
Home |
Main Index |
Thread Index |
Old Index