git: 34718e01869b - main - linuxulator: map IFF_LOWER_UP through NETLINK_ROUTE for Linux apps

From: Devin Teske <dteske_at_FreeBSD.org>
Date: Tue, 11 Aug 2026 17:32:20 UTC
The branch main has been updated by dteske:

URL: https://cgit.FreeBSD.org/src/commit/?id=34718e01869b9ce0baf9c859fafe9d54f785464f

commit 34718e01869b9ce0baf9c859fafe9d54f785464f
Author:     Devin Teske <dteske@FreeBSD.org>
AuthorDate: 2026-08-11 17:29:53 +0000
Commit:     Devin Teske <dteske@FreeBSD.org>
CommitDate: 2026-08-11 17:29:53 +0000

    linuxulator: map IFF_LOWER_UP through NETLINK_ROUTE for Linux apps
    
    rtnl_if_flags_to_linux() translated the usual IFF_* bits but dropped
    FreeBSD's IFF_LOWER_UP (IFF_NETLINK_1).  Chromium's AddressTrackerLinux
    only treats a link as online when ifi_flags has UP|LOWER_UP|RUNNING; with
    LOWER_UP missing, online_links stays empty, ConnectionType is
    CONNECTION_NONE, and navigator.onLine is false even though TCP/HTTPS
    work.  Linux Chromium under the Linuxulator (e.g. www/linux-brave) then
    shows a spurious Offline UI; sites that ignore navigator.onLine do not.
    Native www/chromium is on a different notifier path.
    
    Map IFF_LOWER_UP to Linux's IFF_LOWER_UP (1<<16) and define
    LINUX_IFF_LOWER_UP alongside the existing LINUX_IFF_* constants.
    
    PR:     297424
    
    Reviewed by:    pouria, adrian (previous revision)
    Differential Revision:  https://reviews.freebsd.org/D58774
---
 sys/compat/linux/linux.h         | 3 +++
 sys/compat/linux/linux_netlink.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h
index a9f753cd55b7..0c46860a6b36 100644
--- a/sys/compat/linux/linux.h
+++ b/sys/compat/linux/linux.h
@@ -124,6 +124,9 @@ struct l_sockaddr {
 #define	LINUX_IFF_PORTSEL	0x2000
 #define	LINUX_IFF_AUTOMEDIA	0x4000
 #define	LINUX_IFF_DYNAMIC	0x8000
+/* Volatile (netlink / ifinfomsg); not representable in ifr_flags short */
+#define	LINUX_IFF_LOWER_UP	0x10000
+#define	LINUX_IFF_DORMANT	0x20000
 
 /* sigaltstack */
 #define	LINUX_SS_ONSTACK	1
diff --git a/sys/compat/linux/linux_netlink.c b/sys/compat/linux/linux_netlink.c
index 256f188385ce..8c1659cb1dd8 100644
--- a/sys/compat/linux/linux_netlink.c
+++ b/sys/compat/linux/linux_netlink.c
@@ -342,8 +342,11 @@ rtnl_if_flags_to_linux(unsigned int if_flags)
 		case IFF_DYING:
 			/* No Linux analogue */
 			break;
+		case IFF_LOWER_UP:	/* IFF_NETLINK_1 */
+			result |= LINUX_IFF_LOWER_UP;
+			break;
 		case IFF_MULTICAST:
-			result |= 1 << 12;
+			result |= LINUX_IFF_MULTICAST;
 		}
 	}
 	return (result);