🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #162

[Bug 299638] Linuxulator: SIOCGIFHWADDR returns original MAC instead of current interface MAC

#162
From: bugzilla-noreply
Date: Tue, 20 Oct 2026 13:29
105 lines
6340 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299638

            Bug ID: 299638
           Summary: Linuxulator: SIOCGIFHWADDR returns original MAC
                    instead of current interface MAC
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: david@remdrivet.se

Created attachment 276001
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=276001&action=edit
Fix Linuxulator’s SIOCGIFHWADDR to return the interface’s current MAC address

I ran into this while trying to activate a licensed Linux application (DaVinci
Resolve Studio) in a Rocky Linux 9.8 VNET jail on FreeBSD. The application
started, but I couldn't get the license activation to work.

While investigating, I found that Linux SIOCGIFHWADDR and
/sys/class/net/eth0/address reported different MAC addresses for the same
interface. The ioctl returned the original hardware address, while sysf
returned the currently configured address.
Comparing these with native FreeBSD ifconfig confirmed that the ioctl matched
"hwaddr" and sysfs matched "ether". The interface was an epair with a
configured MAC that differed from its original address.

I had to patch sys/compat/linux/linux_ioctl.c to make SIOCGIFHWADDR return the
current address. In linux_ioctl_socket_ifreq(), it currently goes through
FreeBSD's SIOCGHWADDR, which returns the original address.

The attached patch uses the existing linux_ifhwaddr() helper instead, as
linsysfs already does, with NET_EPOCH protection. It also lets the helper
report the loopback hardware type rather than treating it as Ethernet.

After building and loading the patched linux64 module, the ioctl and sysfs
results matched, and the application's license activation succeeded.

I have since been able to restart the application and jail and use the
application. I haven't traced the licensing internals, so I can't say exactly
how it uses these addresses, but the inconsistent ioctl result seems like a
Linux compatibility bug on its own.

Tested on FreeBSD 16.0-CURRENT amd64, main-n290191-02971f200083. The linux64
module built successfully with the kernel's -Werror flags. Any broader
regression testing have not yet been done.

To reproduce the address mismatch independently of the application, use a Linux
VNET jail with an Ethernet interface named eth0 whose configured MAC differs
from its original hardware address. Compare Linux SIOCGIFHWADDR with
/sys/class/net/eth0/address, and compare both with native FreeBSD ifconfig's
ether/hwaddr fields. I expect the Linux ioctl to return the current address,
matching sysfs.
Before the patch it returned the original address; after the patch they
matched.

There were also two network setup details along the way. With the jail's
original interface name, aaadx_net1b, Linux SIOCGIFADDR failed with EINVAL;
using eth0 made that query work.
The jail's lo0 was initially down and had no IPv4 address, so I also brought it
up with 127.0.0.1/8. After that, address queries worked for eth0 and for both
lo/lo0. Activation still failed until the MAC-address patch was applied.

The working setup therefore uses eth0 and a configured loopback, but I haven't
established that the licensing code requires those exact names. Perhaps it's
hardcoded to make sure it's a Linux system?
The interface-name lookup issue and missing loopback configuration are separate
from the hardware-address ioctl bug addressed by this patch.
The patch doesn't change the interface MAC or any application/license files.

I hope someone are interested in addressing this and for it to be solved to
further the awesome linuxlator compatibility rather than having to manually
patch this in the future.

Note:
Testing, investigating and experimenting with the patch was done with the help
of an llm, so someone who knows the source should have a look and perhaps make
a more elegant solution.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-299638-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 299638] Linuxulator: SIOCGIFHWADDR returns original MAC instead
 of current interface MAC
Date: Tue, 20 Oct 2026 13:29:05 +0000
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-bugs@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-299638-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="52036"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1792502945;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Ux/VfhBc+0csn7LYEg1SQ7pgkHezo4k7VmSAtoSvvlI=;
	b=rkJP5wvmgPY/v464dgf4yGxD+Di46rzfxfXLmt1vQBQashZmiXjf8tA6RE2Km1zINL1OxK
	ytFjKf/Y8UWLW+hvNFHb+dHKXL9Mk9pM2xDZbRc4zJUBrGY1dzbkxmA65iNIBUC9ayR+BF
	iIdBzpL9qbQmyH7mFQRSXdKEfXleOtTnrfcG+EwwNVn9ZZrXnW/t9oyF3MCw9aUz3L9IU1
	SsCQayCtin6GnyLpPF6GU55SPSS9cr+XrZBCflzc1ZORXU8ZZPt7EQi8hXZ9/uVm/I5wTj
	hgKTD/lgIYq8FU+1goLFfDYftU7amKy5sHGpFugB5jERh4v9OqsLecqUD5zIbQ==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes