diff options
| author | Roy Marples <roy@marples.name> | 2020-06-05 14:39:06 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-06-05 14:39:06 +0100 |
| commit | 1ee06bcb81782fe304e0072e91b8c20d894436dc (patch) | |
| tree | f03b50cac05efc78bd38ed754a96d411133af328 /src/if-bsd.c | |
| parent | 27076dc0e78b65efda83d0eedffc6ab5257274b1 (diff) | |
| download | dhcpcd-1ee06bcb81782fe304e0072e91b8c20d894436dc.tar.xz | |
BSD: In privsep with no GIFALIAS support? getifaddrs over privsep
This makes the heavy weight call even more heavy weight :(
Diffstat (limited to 'src/if-bsd.c')
| -rw-r--r-- | src/if-bsd.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c index 495d9acb..6f2746d0 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1364,7 +1364,18 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam) struct ifaddrs *ifaddrs = NULL, *ifa; sa = rti_info[RTAX_IFA]; - getifaddrs(&ifaddrs); +#ifdef PRIVSEP_GETIFADDRS + if (IN_PRIVSEP(ctx)) { + if (ps_root_getifaddrs(ctx, &ifaddrs) == -1) { + logerr("ps_root_getifaddrs"); + break; + } + } else +#endif + if (getifaddrs(&ifaddrs) == -1) { + logerr("getifaddrs"); + break; + } for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) { if (ifa->ifa_addr == NULL) continue; @@ -1372,6 +1383,11 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam) strcmp(ifa->ifa_name, ifp->name) == 0) break; } +#ifdef PRIVSEP_GETIFADDRS + if (IN_PRIVSEP(ctx)) + free(ifaddrs); + else +#endif freeifaddrs(ifaddrs); if (ifam->ifam_type == RTM_DELADDR) { if (ifa != NULL) |
