Module Name:    src
Committed By:   roy
Date:           Mon Oct 12 15:18:48 UTC 2020

Modified Files:
        src/share/man/man4: carp.4
        src/sys/netinet: ip_carp.c ip_carp.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/carp.4
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/ip_carp.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/carp.4
diff -u src/share/man/man4/carp.4:1.7 src/share/man/man4/carp.4:1.8
--- src/share/man/man4/carp.4:1.7	Thu Jan 16 12:56:39 2020
+++ src/share/man/man4/carp.4	Mon Oct 12 15:18:48 2020
@@ -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 @@ or through the
 .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

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.112 src/sys/netinet/ip_carp.c:1.113
--- src/sys/netinet/ip_carp.c:1.112	Mon Oct 12 11:07:27 2020
+++ src/sys/netinet/ip_carp.c	Mon Oct 12 15:18:48 2020
@@ -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 @@ carp_clone_create(struct if_clone *ifc, 
 	/* 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 @@ carp_update_link_state(struct carp_softc
 		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);

Index: src/sys/netinet/ip_carp.h
diff -u src/sys/netinet/ip_carp.h:1.11 src/sys/netinet/ip_carp.h:1.12
--- src/sys/netinet/ip_carp.h:1.11	Thu Jan 16 12:56:40 2020
+++ src/sys/netinet/ip_carp.h	Mon Oct 12 15:18:48 2020
@@ -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 @@ struct carpreq {
 	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
  */

Reply via email to