-/* $OpenBSD: frontend.c,v 1.59 2021/11/28 12:49:55 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.60 2021/11/28 12:51:52 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
ifm = (struct if_msghdr *)rtm;
if_index = ifm->ifm_index;
if_name = if_indextoname(if_index, ifnamebuf);
+ if (if_name == NULL) {
+ log_debug("RTM_NEWADDR: lost if %d", if_index);
+ frontend_imsg_compose_engine(IMSG_REMOVE_IF, 0, 0,
+ &if_index, sizeof(if_index));
+ remove_iface(if_index);
+ break;
+ }
+
log_debug("RTM_NEWADDR: %s[%u]", if_name, if_index);
update_iface(if_index, if_name);
break;
ifm = (struct if_msghdr *)rtm;
if_index = ifm->ifm_index;
if_name = if_indextoname(if_index, ifnamebuf);
+ if (if_name == NULL) {
+ log_debug("RTM_DELADDR: lost if %d", if_index);
+ frontend_imsg_compose_engine(IMSG_REMOVE_IF, 0, 0,
+ &if_index, sizeof(if_index));
+ remove_iface(if_index);
+ break;
+ }
if (rtm->rtm_addrs & RTA_IFA && rti_info[RTAX_IFA]->sa_family
== AF_INET6) {
del_addr.if_index = if_index;
ifm = (struct if_msghdr *)rtm;
if_index = ifm->ifm_index;
if_name = if_indextoname(if_index, ifnamebuf);
+ if (if_name == NULL) {
+ log_debug("RTM_CHGADDRATTR: lost if %d", if_index);
+ frontend_imsg_compose_engine(IMSG_REMOVE_IF, 0, 0,
+ &if_index, sizeof(if_index));
+ remove_iface(if_index);
+ break;
+ }
if (rtm->rtm_addrs & RTA_IFA && rti_info[RTAX_IFA]->sa_family
== AF_INET6) {
sin6 = (struct sockaddr_in6 *) rti_info[RTAX_IFA];
break;
if_index = ifm->ifm_index;
if_name = if_indextoname(if_index, ifnamebuf);
+ if (if_name == NULL) {
+ log_debug("RTM_DELETE: lost if %d", if_index);
+ frontend_imsg_compose_engine(IMSG_REMOVE_IF, 0, 0,
+ &if_index, sizeof(if_index));
+ remove_iface(if_index);
+ break;
+ }
del_route.if_index = if_index;
memcpy(&del_route.gw, rti_info[RTAX_GATEWAY],