Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet carp: link state is DOWN until it becomes a MASTER



details:   https://anonhg.NetBSD.org/src/rev/6f50f2ee4683
branches:  trunk
changeset: 944822:6f50f2ee4683
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Oct 12 15:18:48 2020 +0000

description:
carp: link state is DOWN until it becomes a MASTER

This is consitent with other BSD's handling of CARP and means
we don't have to carry a custom flag for it.

diffstat:

 share/man/man4/carp.4 |  18 ++----------------
 sys/netinet/ip_carp.c |   9 +++++----
 sys/netinet/ip_carp.h |   5 +----
 3 files changed, 8 insertions(+), 24 deletions(-)

diffs (95 lines):

diff -r 2b4ea56282d0 -r 6f50f2ee4683 share/man/man4/carp.4
--- a/share/man/man4/carp.4     Mon Oct 12 14:29:41 2020 +0000
+++ b/share/man/man4/carp.4     Mon Oct 12 15:18:48 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: carp.4,v 1.7 2020/01/16 12:56:39 kardel Exp $
+.\"    $NetBSD: carp.4,v 1.8 2020/10/12 15:18:48 roy Exp $
 .\"    $OpenBSD: carp.4,v 1.19 2005/08/09 09:52:12 jmc Exp $
 .\"
 .\" Copyright (c) 2003, Ryan McBride.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 16, 2020
+.Dd October 12, 2020
 .Dt CARP 4
 .Os
 .Sh NAME
@@ -76,20 +76,6 @@
 .Dv SIOCSVH
 ioctl.
 .Pp
-Setting the
-.Cm link0
-parameter will cause the carp interface to report
-.Dv LINK_STATE_DOWN
-in non
-.Dv MASTER/BACKUP
-mode instead of
-.Dv LINK_STATE_UNKNOWN
-as link status.
-This prevents routing software to announce routes for the carp
-interface when in
-.Dv INIT
-mode.
-.Pp
 Additionally, there are a number of global parameters which can be set using
 .Xr sysctl 8 :
 .Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxxxx
diff -r 2b4ea56282d0 -r 6f50f2ee4683 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Mon Oct 12 14:29:41 2020 +0000
+++ b/sys/netinet/ip_carp.c     Mon Oct 12 15:18:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $        */
+/*     $NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $        */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.112 2020/10/12 11:07:27 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.113 2020/10/12 15:18:48 roy Exp $");
 
 /*
  * TODO:
@@ -890,6 +890,7 @@
        /* Overwrite ethernet defaults */
        ifp->if_type = IFT_CARP;
        ifp->if_output = carp_output;
+       ifp->if_link_state = LINK_STATE_DOWN;
        carp_set_enaddr(sc);
        if_register(ifp);
 
@@ -2228,8 +2229,8 @@
                link_state = LINK_STATE_UP;
                break;
        default:
-               link_state = ((sc->sc_if.if_flags & IFF_ONLY_MASTER_UP) != 0)
-                            ? LINK_STATE_DOWN : LINK_STATE_UNKNOWN;
+               /* Not useable, so down makes perfect sense. */
+               link_state = LINK_STATE_DOWN;
                break;
        }
        if_link_state_change(&sc->sc_if, link_state);
diff -r 2b4ea56282d0 -r 6f50f2ee4683 sys/netinet/ip_carp.h
--- a/sys/netinet/ip_carp.h     Mon Oct 12 14:29:41 2020 +0000
+++ b/sys/netinet/ip_carp.h     Mon Oct 12 15:18:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.h,v 1.11 2020/01/16 12:56:40 kardel Exp $      */
+/*     $NetBSD: ip_carp.h,v 1.12 2020/10/12 15:18:48 roy Exp $ */
 /*     $OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $        */
 
 /*
@@ -133,9 +133,6 @@
        unsigned char   carpr_key[CARP_KEY_LEN];
 };
 
-/* enable link status up only for MASTER state */
-#define IFF_ONLY_MASTER_UP       IFF_LINK0
-
 /*
  * Names for CARP sysctl objects
  */



Home | Main Index | Thread Index | Old Index