Applied, thanks!

I have also ported the sa_len and controlfixes to pfinet.
(we really don't want to hard-couple the migration to dhcpcd with the
migration to lwip)

Joan Lledó, le dim. 04 janv. 2026 11:42:27 +0100, a ecrit:
> dhcpcd expects us to implement a function called `if_carrier` to determine
> whether the cable is plugged or not. In my last implementation. This calls
> the `SIOCGIFFLAGS` ioctl, which after the changes in this patch, will take
> the IFF_RUNNING flag from the gnumach driver. 
> 
> 
> On the other hand, see this code from glibc, in sysdeps/mach/hurd/ifaddrs.c:
> 
> ```
>   else if (!strncmp (cur, "--address=", 10))
>     {
>       i++;
>       /* IPv4 address */
>       addr = cur + 10;
> 
>       storage[i].ia.ifa_next = &storage[i + 1].ia;
>       storage[i].ia.ifa_name = strncpy (storage[i].name, ifa_name, sizeof 
> (storage[i].name));
> 
>       storage[i].ia.ifa_addr = (struct sockaddr *) &storage[i].addr;
>       sin = ((struct sockaddr_in *) &storage[i].addr);
>       sin->sin_family = AF_INET;
>       sin->sin_len = sizeof(*sin);
>       sin->sin_port = 0;
>       inet_pton (AF_INET, addr, &sin->sin_addr);
> 
>       storage[i].ia.ifa_netmask = NULL;
>       storage[i].ia.ifa_broadaddr = NULL;
> 
>       storage[i].ia.ifa_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING | 
> IFF_MULTICAST;
>       storage[i].ia.ifa_data = NULL; /* Nothing here for now.  */
>     }
> ```
> 
> So the call to `getifaddrs()` will set the IFF_RUNNING flag if the interface 
> has
> an IP address set. This doesn't seem right to me because the cable could be
> unplugged and still the iface would be up and have an IP in the network stack.
> WDYT?

That ifaddrs.c was a quick&dirty hack to get it ported, it probably
needs fixing.

Samuel

Reply via email to