Module Name:    src
Committed By:   roy
Date:           Tue Sep 24 15:23:53 UTC 2024

Modified Files:
        src/share/man/man4: vether.4
        src/sys/net: if_vether.c

Log Message:
vether(4): link0 now means link state up

Which makes more sense than -link0 meaning link state up.
link0 is now a default flag when the interface is created.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/vether.4
cvs rdiff -u -r1.2 -r1.3 src/sys/net/if_vether.c

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/vether.4
diff -u src/share/man/man4/vether.4:1.4 src/share/man/man4/vether.4:1.5
--- src/share/man/man4/vether.4:1.4	Tue Sep 24 14:19:02 2024
+++ src/share/man/man4/vether.4	Tue Sep 24 15:23:53 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vether.4,v 1.4 2024/09/24 14:19:02 uwe Exp $
+.\"	$NetBSD: vether.4,v 1.5 2024/09/24 15:23:53 roy Exp $
 .\"
 .\"	$OpenBSD: vether.4,v 1.5 2017/10/17 22:47:58 schwarze Exp $
 .\"
@@ -50,10 +50,10 @@ link state can be controlled using
 .Bl -tag -offset indent -width Cm -compact
 .It Cm link0
 link state
-.Dq down
+.Dq up
 .It Fl link0
 link state
-.Dq up
+.Dq down
 .El
 .Sh SEE ALSO
 .Xr bridge 4 ,

Index: src/sys/net/if_vether.c
diff -u src/sys/net/if_vether.c:1.2 src/sys/net/if_vether.c:1.3
--- src/sys/net/if_vether.c:1.2	Tue Sep 24 13:03:30 2024
+++ src/sys/net/if_vether.c	Tue Sep 24 15:23:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vether.c,v 1.2 2024/09/24 13:03:30 roy Exp $	*/
+/*	$NetBSD: if_vether.c,v 1.3 2024/09/24 15:23:53 roy Exp $	*/
 /* $OpenBSD: if_vether.c,v 1.27 2016/04/13 11:41:15 mpi Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vether.c,v 1.2 2024/09/24 13:03:30 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vether.c,v 1.3 2024/09/24 15:23:53 roy Exp $");
 
 #include <sys/cprng.h>
 #include <sys/kmem.h>
@@ -64,7 +64,7 @@ vether_clone_create(struct if_clone *ifc
 	ifp = &sc->sc_ec.ec_if;
 	if_initname(ifp, ifc->ifc_name, unit);
 	ifp->if_softc = sc;
-	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_LINK0;
 #ifdef NET_MPSAFE
 	ifp->if_extflags = IFEF_MPSAFE;
 #endif
@@ -89,6 +89,8 @@ vether_clone_create(struct if_clone *ifc
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);
 
+	if_link_state_change(ifp, LINK_STATE_UP);
+
 	return 0;
 }
 
@@ -108,8 +110,6 @@ vether_init(struct ifnet *ifp)
 {
 
 	ifp->if_flags |= IFF_RUNNING;
-	if (!(ifp->if_flags & IFF_LINK0))
-		if_link_state_change(ifp, LINK_STATE_UP);
 	vether_start(ifp);
 	return 0;
 }
@@ -154,7 +154,7 @@ vether_ioctl(struct ifnet *ifp, unsigned
                 if ((error = ifioctl_common(ifp, cmd, data)) != 0)
 			break;
 		if_link_state_change(ifp, ifp->if_flags & IFF_LINK0 ?
-		    LINK_STATE_DOWN : LINK_STATE_UP);
+		    LINK_STATE_UP : LINK_STATE_DOWN);
 		break;
 
 	default:

Reply via email to