-/* $OpenBSD: dhcpleased.c,v 1.19 2021/08/12 12:41:08 florian Exp $ */
+/* $OpenBSD: dhcpleased.c,v 1.20 2021/08/24 14:54:02 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
AF_INET)) == -1)
fatal("route socket");
- rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_PROPOSAL);
+ rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_PROPOSAL) |
+ ROUTE_FILTER(RTM_IFANNOUNCE);
if (setsockopt(frontend_routesock, AF_ROUTE, ROUTE_MSGFILTER,
&rtfilter, sizeof(rtfilter)) == -1)
fatal("setsockopt(ROUTE_MSGFILTER)");
-/* $OpenBSD: frontend.c,v 1.20 2021/08/23 18:22:56 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.21 2021/08/24 14:54:02 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
void
handle_route_message(struct rt_msghdr *rtm, struct sockaddr **rti_info)
{
- struct sockaddr_dl *sdl = NULL;
+ struct sockaddr_dl *sdl = NULL;
+ struct if_announcemsghdr *ifan;
+ uint32_t if_index;
+
switch (rtm->rtm_type) {
case RTM_IFINFO:
if (rtm->rtm_addrs & RTA_IFP && rti_info[RTAX_IFP]->sa_family
sdl = (struct sockaddr_dl *)rti_info[RTAX_IFP];
update_iface((struct if_msghdr *)rtm, sdl);
break;
+ case RTM_IFANNOUNCE:
+ ifan = (struct if_announcemsghdr *)rtm;
+ if_index = ifan->ifan_index;
+ if (ifan->ifan_what == IFAN_DEPARTURE) {
+ frontend_imsg_compose_engine(IMSG_REMOVE_IF, 0, 0,
+ &if_index, sizeof(if_index));
+ remove_iface(if_index);
+ }
+ break;
case RTM_PROPOSAL:
if (rtm->rtm_priority == RTP_PROPOSAL_SOLICIT) {
log_debug("RTP_PROPOSAL_SOLICIT");
}
#ifndef SMALL
else if (rtm->rtm_flags & RTF_PROTO3) {
- uint32_t if_index;
char ifnamebuf[IF_NAMESIZE], *if_name;
if_index = rtm->rtm_index;