NetworkConfiguration / dhcpcd

DHCP / IPv4LL / IPv6RA / DHCPv6 client.
https://roy.marples.name/projects/dhcpcd
BSD 2-Clause "Simplified" License
348 stars 112 forks source link

dhcpcd-master : no ipv4 addr #127

Closed maravtdm closed 1 year ago

maravtdm commented 2 years ago

Hi,

OS : Slackware DHCPCD Version : dhcpcd-ce13b79 Kernel : 5.19.6

I recently compiled dhcpcd-master And with that release, I don't get any ipv4 address

ditto for the route:

blackstar :: ~ » route -n   
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

Attached file : /var/log/messages after restarting NetworkManger dhcpcd_after_NM_restart.txt

maravtdm commented 2 years ago

Note: it works fine when compiled with : -disable-privsep

maravtdm commented 2 years ago

I also noticed this warning during compilation ( with --enable-privsep --privsepuser=dhcpcd )

cc -O2 -fPIC -std=c99 -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c bpf.c -o bpf.o
bpf.c: In function 'bpf_bootp':
bpf.c:708:2: warning: #warning A compromised PF_PACKET socket can be used as a raw socket [-Wcpp]
  708 | #warning A compromised PF_PACKET socket can be used as a raw socket
rsmarples commented 2 years ago

Linux kernel only supports BPF read filter, not a write filter. The warning is to prompt someone knowledgable about the linux kernel to do something about that.

rsmarples commented 2 years ago

So with the commit prior to ce13b79 NM works fine with dhcpcd and privsep?

maravtdm commented 2 years ago

I tried some commit behind this one with the same result But I have a snapshot of my system from 2022-08-26, and if I use /sbin/dhcpcd from that date, it works fine The things that have changed are mostly kernel updates and NetworkManager 1.40

maravtdm commented 2 years ago

revert to NM 1.38.4 : not better

I also noticed this error : NetworkManager[921]: [1662325284.8630] dhcp4 (wlan0): client pid 2276 killed by signal 31

maravtdm commented 2 years ago

If I kill the dhcpcd process et restart it manually, it works :

# dhcpcd -d -t 30 -L wlan0
dhcpcd-9.99.0 starting
chrooting as dhcpcd to /var/lib/dhcpcd
sandbox: seccomp
spawned manager process on PID 6729
spawned privileged proxy on PID 6730
spawned network proxy on PID 6731
spawned controller proxy on PID 6732
DUID 00:01:00:01:2a:8e:4e:23:20:1e:88:51:f7:11
wlan0: spawned DHCP6 proxy 2a01:e0a:5b:dae0:4918:6473:bf6d:d976 on PID 6733
wlan0: spawned DHCP6 proxy fe80::c01f:2a9c:3dbd:7c4c on PID 6734
wlan0: executing: /lib/dhcpcd/dhcpcd-run-hooks PREINIT
wlan0: connected to Access Point: 01_marav_05
wlan0: executing: /lib/dhcpcd/dhcpcd-run-hooks CARRIER
wlan0: IAID 88:51:f7:11
wlan0: delaying IPv6 router solicitation for 0.2 seconds
wlan0: delaying IPv4 for 0.1 seconds
wlan0: reading lease: /var/lib/dhcpcd/wlan0-01_marav_05.lease
wlan0: rebinding lease of 192.168.111.185
wlan0: spawned BPF ARP 192.168.111.185 on PID 6737
wlan0: sending REQUEST (xid 0xa5afd0f6), next in 3.8 seconds
wlan0: spawned BPF BOOTP on PID 6738
wlan0: acknowledged 192.168.111.185 from 192.168.111.254
wlan0: probing address 192.168.111.185/24
wlan0: probing for 192.168.111.185
wlan0: ARP probing 192.168.111.185 (1 of 3), next in 2.0 seconds
wlan0: soliciting an IPv6 router
wlan0: sending Router Solicitation
wlan0: Router Advertisement from fe80::e69e:12ff:fe1e:cdcd
wlan0: adding address 2a01:e0a:5b:dae0:cd6:dba2:b413:9ddd/64
wlan0: pltime 86400 seconds, vltime 86400 seconds
wlan0: adding route to 2a01:e0a:5b:dae0::/64
wlan0: adding default route via fe80::e69e:12ff:fe1e:cdcd
wlan0: waiting for Router Advertisement DAD to complete
wlan0: No DHCPv6 instruction in RA
wlan0: process DHCP6 proxy 2a01:e0a:5b:dae0:4918:6473:bf6d:d976 already started on pid 6733
wlan0: Router Advertisement DAD completed
wlan0: executing: /lib/dhcpcd/dhcpcd-run-hooks ROUTERADVERT
forked to background, child pid 6729
maravtdm commented 2 years ago

If I restart NM

root      8241  0.6  0.1 289504 17252 ?        Ssl  23:35   0:00 /usr/sbin/NetworkManager
dhcpcd    8267  0.0  0.0   5024  3492 ?        S    23:35   0:00  \_ dhcpcd: wlan0 [ip4]
root      8268  0.0  0.0   5028  2168 ?        S    23:35   0:00      \_ dhcpcd: [privileged proxy] wlan0 [ip4]
dhcpcd    8270  0.0  0.0   5028   472 ?        S    23:35   0:00      |   \_ dhcpcd: [BPF ARP] wlan0 192.168.111.185
dhcpcd    8271  0.0  0.0   5028   472 ?        S    23:35   0:00      |   \_ dhcpcd: [BPF BOOTP] wlan0
dhcpcd    8269  0.0  0.0   5020   460 ?        S    23:35   0:00      \_ dhcpcd: [control proxy] wlan0 [ip4]
# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 2a01:e0a:5b:dae0:4918:6473:bf6d:d976  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::c01f:2a9c:3dbd:7c4c  prefixlen 64  scopeid 0x20<link>
        ether 20:1e:88:51:f7:11  txqueuelen 1000  (Ethernet)
        RX packets 7168  bytes 8696070 (8.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2256  bytes 374876 (366.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

FYI: dhcpcd : dhcpcd-ce13b79 NM : 1.40.0

maravtdm commented 2 years ago

I noticed this in /var/log/syslog :

NetworkManager[8241]: [1662327346.3464] keyfile: ipv6.addr-gen-mode: invalid option "default"; use one of [eui64,stable-privacy]

maravtdm commented 2 years ago

ok So, it works fine now if I disable "privacy" in the settings of ipv6 (KDE Plasma) If it sets to "default", dhcpcd won't get ipv4 addr. Screenshot_20220904_235059

... It has worked, but no I rebooted my PC, and the situation is the same

rsmarples commented 2 years ago

SIGSYS is what intrests me. It's likely another SECCOMP issue. Can you compile dhcpcd with -DSECCOMP_FILTER_DEBUG in your CPPFLAGS please?

maravtdm commented 2 years ago

Done

make[1]: Entering directory '/tmp/dhcpcd-ce13b79/src'
Makefile:55: warning: ignoring prerequisites on suffix rule definition
cc -O2 -fPIC -std=c99 -DSECCOMP_FILTER_DEBUG -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c common.c -o common.o

Same in /var/log/messages (no difference) In /var/log/syslog, I noticed this on NM stop:


Sep  5 12:19:11 blackstar dhcpcd[6712]: ps_seccomp_violation: unexpected syscall 230 (arch=0xc000003e)
Sep  5 12:19:11 blackstar dhcpcd[6712]: ps_root_recvmsg: Connection reset by peer
rsmarples commented 2 years ago

Closed by mistake - wups. But can you test the above patch please? I'm hopeful that it might fix it, or at least the SIGSYS error.

maravtdm commented 2 years ago

Thx I will test as soon as I get home

maravtdm commented 2 years ago

edit: still have the issue with the patch

maravtdm commented 2 years ago

No more SIGSYS error with your latest commit 8c54cd6, but I still have the ipv4 issue

rsmarples commented 2 years ago

I've pushed another patch, but mainly for process management. I don't think it will fix anything but it's worth a shout. I think I'll have to try and get a NM development environment working which means a new VM to spin up. Maybe I'll look into Slackware for the first time.

maravtdm commented 2 years ago

Indeed, still have the issue with commit 4627c5d

maravtdm commented 2 years ago

FYI I'm able to reproduce the same issue with Slackware 15.0 with: glibc 2.33 NetworkManager 1.32.12 and your latest commit of dhcpcd

Slackware 15.0: https://mirrors.slackware.com/slackware/slackware-iso/slackware64-15.0-iso/slackware64-15.0-install-dvd.iso

However, if you want to test with glibc 2.36 and NM 1.40, you can download the latest iso of the dev branch (-current) here: https://slackware.nl/slackware/slackware64-current-iso/slackware64-current-install-dvd.iso

maravtdm commented 1 year ago

Hi Roy,

Any news on this one ?

Cheers

maravtdm commented 1 year ago

Some updates here, hope this help
I put the log in /var/log/dhcpcd.log
And here is the output of 9.4.1 and your master branch

9.4.1

Nov 28 00:49:28 [19371]: dhcpcd-9.4.1 starting
Nov 28 00:49:28 [19371]: spawned privileged proxy on PID 19372
Nov 28 00:49:28 [19371]: spawned controller proxy on PID 19373
Nov 28 00:49:28 [19371]: DUID 00:01:00:01:2a:8e:4e:23:20:1e:88:51:f7:11
Nov 28 00:49:28 [19371]: wlan0: executing: /usr/libexec/nm-dhcp-helper PREINIT
Nov 28 00:49:28 [19371]: wlan0: connected to Access Point: 01_marav_05
Nov 28 00:49:28 [19371]: wlan0: IAID 88:51:f7:11
Nov 28 00:49:28 [19371]: wlan0: delaying IPv4 for 0.1 seconds
Nov 28 00:49:28 [19371]: wlan0: reading lease: /var/lib/dhcpcd/wlan0-01_marav_05.lease
Nov 28 00:49:28 [19371]: wlan0: rebinding lease of 192.168.111.100
Nov 28 00:49:28 [19372]: wlan0: spawned BPF ARP on PID 19381
Nov 28 00:49:28 [19371]: wlan0: sending REQUEST (xid 0x78a6c742), next in 3.6 seconds
Nov 28 00:49:28 [19372]: wlan0: spawned BPF BOOTP on PID 19382
Nov 28 00:49:28 [19371]: wlan0: acknowledged 192.168.111.100 from 192.168.111.254
Nov 28 00:49:28 [19371]: wlan0: leased 192.168.111.100 for 43200 seconds
Nov 28 00:49:28 [19371]: wlan0: renew in 21600 seconds, rebind in 37800 seconds
Nov 28 00:49:28 [19371]: wlan0: writing lease: /var/lib/dhcpcd/wlan0-01_marav_05.lease
Nov 28 00:49:28 [19371]: wlan0: executing: /usr/libexec/nm-dhcp-helper REBOOT
Nov 28 00:49:28 [19392]: spawned listener 192.168.111.100 on PID 19392
Nov 28 00:50:10 [19371]: received SIGTERM, stopping
Nov 28 00:50:10 [19371]: wlan0: removing interface
Nov 28 00:50:10 [19371]: wlan0: executing: /usr/libexec/nm-dhcp-helper STOP
Nov 28 00:50:10 [19372]: ps_root_recvmsg: Connection refused
Nov 28 00:50:10 [19373]: ps_ctl_listen: read: Success
Nov 28 00:50:10 [19373]: ps_ctl_recv: read: Success

Master:

Nov 28 00:50:20 [22208]: dhcpcd-9.99.0 starting
Nov 28 00:50:20 [22208]: spawned privileged proxy on PID 22209
Nov 28 00:50:20 [22208]: spawned controller proxy on PID 22210
Nov 28 00:50:20 [22208]: DUID 00:01:00:01:2a:8e:4e:23:20:1e:88:51:f7:11
Nov 28 00:50:20 [22208]: wlan0: connected to Access Point: 01_marav_05
Nov 28 00:50:20 [22208]: wlan0: IAID 88:51:f7:11
Nov 28 00:50:20 [22208]: wlan0: delaying IPv4 for 1.6 seconds
Nov 28 00:50:22 [22208]: wlan0: reading lease: /var/lib/dhcpcd/wlan0-01_marav_05.lease
Nov 28 00:50:22 [22208]: wlan0: rebinding lease of 192.168.111.100
Nov 28 00:50:22 [22209]: wlan0: spawned BPF ARP 192.168.111.100 on PID 22241
Nov 28 00:50:22 [22208]: wlan0: sending REQUEST (xid 0x4dd77d5), next in 5.0 seconds
Nov 28 00:50:22 [22209]: wlan0: spawned BPF BOOTP on PID 22242
Nov 28 00:50:22 [22208]: wlan0: acknowledged 192.168.111.100 from 192.168.111.254
Nov 28 00:50:22 [22208]: wlan0: leased 192.168.111.100 for 43200 seconds
Nov 28 00:50:22 [22208]: wlan0: renew in 21600 seconds, rebind in 37800 seconds
Nov 28 00:50:22 [22208]: wlan0: writing lease: /var/lib/dhcpcd/wlan0-01_marav_05.lease

... and it stay like that

maravtdm commented 1 year ago

Hi Roy,

Good news
The problem seems to be solved with dhcpcd from commit 6797c08