This should make debugging easier with third party software.
}
void
-dhcp_handleifa(int cmd, struct ipv4_addr *ia)
+dhcp_handleifa(int cmd, struct ipv4_addr *ia, pid_t pid)
{
struct interface *ifp;
struct dhcp_state *state;
if (cmd == RTM_DELADDR) {
if (state->addr == ia) {
- loginfox("%s: deleted IP address %s",
- ifp->name, ia->saddr);
+ loginfox("%s: pid %d deleted IP address %s",
+ ifp->name, pid, ia->saddr);
state->addr = NULL;
/* Don't clear the added state as we need
* to drop the lease. */
ssize_t dhcp_env(char **, const char *, const struct bootp *, size_t,
const struct interface *);
-void dhcp_handleifa(int, struct ipv4_addr *);
+void dhcp_handleifa(int, struct ipv4_addr *, pid_t pid);
void dhcp_drop(struct interface *, const char *);
void dhcp_start(struct interface *);
void dhcp_abort(struct interface *);
}
void
-dhcp6_handleifa(int cmd, struct ipv6_addr *ia)
+dhcp6_handleifa(int cmd, struct ipv6_addr *ia, pid_t pid)
{
struct dhcp6_state *state;
struct interface *ifp = ia->iface;
dhcp6_listen(ia->iface->ctx, ia);
if ((state = D6_STATE(ifp)) != NULL)
- ipv6_handleifa_addrs(cmd, &state->addrs, ia);
+ ipv6_handleifa_addrs(cmd, &state->addrs, ia, pid);
}
ssize_t
ssize_t dhcp6_env(char **, const char *, const struct interface *,
const struct dhcp6_message *, size_t);
void dhcp6_free(struct interface *);
-void dhcp6_handleifa(int, struct ipv6_addr *);
+void dhcp6_handleifa(int, struct ipv6_addr *, pid_t);
int dhcp6_dadcompleted(const struct interface *);
void dhcp6_drop(struct interface *, const char *);
void dhcp6_dropnondelegates(struct interface *ifp);
struct interface *ifp;
const struct sockaddr *rti_info[RTAX_MAX];
int addrflags;
+ pid_t pid;
if ((ifp = if_findindex(ctx->ifaces, ifam->ifam_index)) == NULL)
return;
}
#endif
}
+ pid = ifam->ifam_pid;
+#else
+ pid = 0;
#endif
#ifdef HAVE_IFAM_ADDRFLAGS
#endif
ipv4_handleifa(ctx, ifam->ifam_type, NULL, ifp->name,
- &addr, &mask, &bcast, addrflags);
+ &addr, &mask, &bcast, addrflags, pid);
break;
}
#endif
#endif
ipv6_handleifa(ctx, ifam->ifam_type, NULL,
- ifp->name, &addr6, ipv6_prefixlen(&mask6), addrflags);
+ ifp->name, &addr6, ipv6_prefixlen(&mask6), addrflags, pid);
break;
}
#endif
rta = RTA_NEXT(rta, len);
}
ipv4_handleifa(ctx, nlm->nlmsg_type, NULL, ifp->name,
- &addr, &net, &brd, ifa->ifa_flags);
+ &addr, &net, &brd, ifa->ifa_flags, (pid_t)nlm->nlmsg_pid);
break;
#endif
#ifdef INET6
rta = RTA_NEXT(rta, len);
}
ipv6_handleifa(ctx, nlm->nlmsg_type, NULL, ifp->name,
- &addr6, ifa->ifa_prefixlen, ifa->ifa_flags);
+ &addr6, ifa->ifa_prefixlen, ifa->ifa_flags,
+ (pid_t)nlm->nlmsg_pid);
break;
#endif
}
ipv4_handleifa(ctx,
ifam->ifam_type == RTM_CHGADDR ?
RTM_NEWADDR : ifam->ifam_type,
- NULL, ifalias, &addr, &mask, &bcast, flags);
+ NULL, ifalias, &addr, &mask, &bcast, flags, 0);
break;
}
#endif
ipv6_handleifa(ctx,
ifam->ifam_type == RTM_CHGADDR ?
RTM_NEWADDR : ifam->ifam_type,
- NULL, ifalias, &addr6, ipv6_prefixlen(&mask6), flags);
+ NULL, ifalias, &addr6, ipv6_prefixlen(&mask6), flags, 0);
break;
}
#endif
#endif
ipv4_handleifa(ctx, RTM_NEWADDR, ifs, ifa->ifa_name,
&addr->sin_addr, &net->sin_addr,
- brd ? &brd->sin_addr : NULL, addrflags);
+ brd ? &brd->sin_addr : NULL, addrflags, 0);
break;
#endif
#ifdef INET6
#endif
ipv6_handleifa(ctx, RTM_NEWADDR, ifs,
ifa->ifa_name, &sin6->sin6_addr,
- ipv6_prefixlen(&net6->sin6_addr), addrflags);
+ ipv6_prefixlen(&net6->sin6_addr), addrflags, 0);
break;
#endif
}
ipv4_handleifa(struct dhcpcd_ctx *ctx,
int cmd, struct if_head *ifs, const char *ifname,
const struct in_addr *addr, const struct in_addr *mask,
- const struct in_addr *brd, const int addrflags)
+ const struct in_addr *brd, int addrflags, pid_t pid)
{
struct interface *ifp;
struct ipv4_state *state;
#ifdef ARP
arp_handleifa(cmd, ia);
#endif
- dhcp_handleifa(cmd, ia);
+ dhcp_handleifa(cmd, ia, pid);
}
if (cmd == RTM_DELADDR)
const struct in_addr *);
void ipv4_handleifa(struct dhcpcd_ctx *, int, struct if_head *, const char *,
const struct in_addr *, const struct in_addr *, const struct in_addr *,
- int);
+ int, pid_t);
void ipv4_free(struct interface *);
#else
/* Simulate the kernel announcing the new address. */
ipv6_handleifa(ia->iface->ctx, RTM_NEWADDR,
ia->iface->ctx->ifaces, ia->iface->name,
- &ia->addr, ia->prefix_len, flags);
+ &ia->addr, ia->prefix_len, flags, 0);
} else {
/* Still tentative? Check again in a bit. */
struct timespec tv;
void
ipv6_handleifa(struct dhcpcd_ctx *ctx,
int cmd, struct if_head *ifs, const char *ifname,
- const struct in6_addr *addr, uint8_t prefix_len, int addrflags)
+ const struct in6_addr *addr, uint8_t prefix_len, int addrflags, pid_t pid)
{
struct interface *ifp;
struct ipv6_state *state;
}
if (ia != NULL) {
- ipv6nd_handleifa(cmd, ia);
- dhcp6_handleifa(cmd, ia);
+ ipv6nd_handleifa(cmd, ia, pid);
+ dhcp6_handleifa(cmd, ia, pid);
/* Done with the ia now, so free it. */
if (cmd == RTM_DELADDR)
int
ipv6_handleifa_addrs(int cmd,
- struct ipv6_addrhead *addrs, const struct ipv6_addr *addr)
+ struct ipv6_addrhead *addrs, const struct ipv6_addr *addr, pid_t pid)
{
struct ipv6_addr *ia, *ian;
uint8_t found, alldadcompleted;
switch (cmd) {
case RTM_DELADDR:
if (ia->flags & IPV6_AF_ADDED) {
- logwarnx("%s: deleted address %s",
- ia->iface->name, ia->saddr);
+ logwarnx("%s: pid %d deleted address %s",
+ ia->iface->name, pid, ia->saddr);
ia->flags &= ~IPV6_AF_ADDED;
}
if (ia->flags & IPV6_AF_DELEGATED) {
void ipv6_freedrop_addrs(struct ipv6_addrhead *, int,
const struct interface *);
void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *,
- const char *, const struct in6_addr *, uint8_t, int);
-int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, const struct ipv6_addr *);
+ const char *, const struct in6_addr *, uint8_t, int, pid_t);
+int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, const struct ipv6_addr *,
+ pid_t);
struct ipv6_addr *ipv6_iffindaddr(struct interface *,
const struct in6_addr *, int);
int ipv6_hasaddr(const struct interface *);
}
void
-ipv6nd_handleifa(int cmd, struct ipv6_addr *addr)
+ipv6nd_handleifa(int cmd, struct ipv6_addr *addr, pid_t pid)
{
struct ra *rap;
TAILQ_FOREACH(rap, addr->iface->ctx->ra_routers, next) {
if (rap->iface != addr->iface)
continue;
- ipv6_handleifa_addrs(cmd, &rap->addrs, addr);
+ ipv6_handleifa_addrs(cmd, &rap->addrs, addr, pid);
}
}
void ipv6nd_expirera(void *arg);
int ipv6nd_hasra(const struct interface *);
int ipv6nd_hasradhcp(const struct interface *);
-void ipv6nd_handleifa(int, struct ipv6_addr *);
+void ipv6nd_handleifa(int, struct ipv6_addr *, pid_t);
int ipv6nd_dadcompleted(const struct interface *);
void ipv6nd_expire(struct interface *, uint32_t);
void ipv6nd_drop(struct interface *);