Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 684285 Details for
Bug 766758
net-misc/netifrc: Interface returning multiple MAC addresses errors out
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
netifrc-use-sysfs-to-obtain-the-mac-address.patch
netifrc-use-sysfs-to-obtain-the-mac-address.patch (text/plain), 1.32 KB, created by
kfm
on 2021-01-24 03:06:46 UTC
(
hide
)
Description:
netifrc-use-sysfs-to-obtain-the-mac-address.patch
Filename:
MIME Type:
Creator:
kfm
Created:
2021-01-24 03:06:46 UTC
Size:
1.32 KB
patch
obsolete
>From 3acfdaa81f96e42037167967bb571665044fa12f Mon Sep 17 00:00:00 2001 >From: Kerin Millar <kfm@plushkava.net> >Date: Sun, 24 Jan 2021 02:49:43 +0000 >Subject: [PATCH] Use sysfs to obtain the MAC address in net/iproute2.sh > >Dispense with the hideous ip-link(8) parser. Instead, collect the MAC address >by reading from the relevant sysfs file. While at it, tidy up the remainder of >the function so that the control flow is easier to ascertain at a glance. Note >that the address will be rendered in upper case, just as it was before. > >Signed-off-by: Kerin Millar <kfm@plushkava.net> >Closes: https://bugs.gentoo.org/766758 > >diff --git a/net/iproute2.sh b/net/iproute2.sh >index 4c32acc..2289587 100644 >--- a/net/iproute2.sh >+++ b/net/iproute2.sh >@@ -70,19 +70,16 @@ _set_flag() > > _get_mac_address() > { >- local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \ >- -e 'y/abcdef/ABCDEF/' \ >- -e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p') >+ local mac= >+ read -r mac < /sys/class/net/"${IFACE}"/address || return 1 > > case "${mac}" in >- 00:00:00:00:00:00);; >- 44:44:44:44:44:44);; >- FF:FF:FF:FF:FF:FF);; >- "");; >- *) echo "${mac}"; return 0;; >+ 00:00:00:00:00:00) return 1 ;; >+ 44:44:44:44:44:44) return 1 ;; >+ ff:ff:ff:ff:ff:ff) return 1 ;; > esac > >- return 1 >+ printf '%s\n' "${mac}" | LC_ALL=C tr '[:lower:]' '[:upper:]' > } > > _set_mac_address()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 766758
:
684285
|
684291