]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolvctl: only remove protocol after last dot when mangling ifname for resolvconf
authorexploide <me@exploide.net>
Wed, 10 Aug 2022 15:35:21 +0000 (17:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Aug 2022 07:59:15 +0000 (09:59 +0200)
ifname_resolvconf_mangle is supposed to remove protocol suffixes like .dhcp
from interface names. But this removed also valid parts of the ifname like
VLAN IDs, e.g. enp2s0u4.72.dhcp -> enp2s0u4 instead of enp2s0u4.72

After this change, everything behind the last dot is removed instead of the first.

src/resolve/resolvectl.c

index aaa1c497c02c8d6d4d71799778f68717ab4123b1..6d08821ecd63a9eff9cccc673995a0b9ccd05608 100644 (file)
@@ -138,7 +138,7 @@ int ifname_resolvconf_mangle(const char *s) {
 
         assert(s);
 
-        dot = strchr(s, '.');
+        dot = strrchr(s, '.');
         if (dot) {
                 _cleanup_free_ char *iface = NULL;