In message <bb84d244-7a86-70f8-ad7e-4d7f1530d...@freebsd.org>, John Baldwin 
wri
tes:
> On 10/19/20 1:37 PM, Cy Schubert wrote:
> > Author: cy
> > Date: Mon Oct 19 20:37:38 2020
> > New Revision: 366857
> > URL: https://svnweb.freebsd.org/changeset/base/366857
> > 
> > Log:
> >   Destroy cloned interfaces at netif stop, netif restart and shutdown.
> >   This is especially important during shutdown because a child interface
> >   of lagg with WOL enabled will not enable WOL at interface shutdown and
> >   thus no WOL to wake up the device (and machine).
> >   
> >   PR:               158734, 109980
> >   Reported by:      Antonio Huete Jimenez <tuxillo at quantumachine.net>
> >             Marat N.Afanasyev <marat at zealot.ksu.ru>
> >   reviewed by:      kp
> >   MFC after:        1 week
> >   Differential Revision:    https://reviews.freebsd.org/D26797
>
> This causes some rather weird breakage for me.  Namely, after this
> change, if I'm logged into a host via ssh and reboot it (via
> shutdown -r now), I no longer get gracefully logged out by the
> shutdown process as the network connections are all killed before
> users are kicked off the system.  Instead, my ssh connection hangs
> around forever until either it times out due to keep alives, or the
> host in question reboots and send back a RST.
>
> As I rather frequently use shutdown -r now or poweroff remotely via
> ssh, I've found this rather annoying as I have to use ~. to recover
> my shell again (and woe to me if it was a nested login and I forgot
> to add enough extra ~'s to escape the N levels).
>
> Probably if you only destroyed cloned interfaces during shutdown and
> not all interfaces that would be a happy-enough compromise that
> would still satisfy the original PR?

I've been looking at this earlier today, a different issue.

This reverts r366857 and adds netifdown to run almost prior to shutdown.

diff --git a/libexec/rc/rc.d/netif b/libexec/rc/rc.d/netif
index b4b8ccb1aede..eb1efc4d6274 100755
--- a/libexec/rc/rc.d/netif
+++ b/libexec/rc/rc.d/netif
@@ -28,7 +28,7 @@
 # PROVIDE: netif
 # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl
 # REQUIRE: hostid ipfs
-# KEYWORD: nojailvnet shutdown
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 . /etc/network.subr
diff --git a/libexec/rc/rc.d/netifdown b/libexec/rc/rc.d/netifdown
new file mode 100755
index 000000000000..8d64a1db06a2
--- /dev/null
+++ b/libexec/rc/rc.d/netifdown
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# PROVIDE: netifdown
+# REQUIRE: netwait
+# KEYWORD: nojailvnet shutdown nostart
+
+. /etc/rc.subr
+. /etc/network.subr
+. /etc/rc.d/netif


I tested it here. It works better than my original solution.


-- 
Cheers,
Cy Schubert <cy.schub...@cschubert.com>
FreeBSD UNIX:  <c...@freebsd.org>   Web:  https://FreeBSD.org
NTP:           <c...@nwtime.org>    Web:  https://nwtime.org

        The need of the many outweighs the greed of the few.



_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to