-/* $OpenBSD: kroute.c,v 1.285 2022/07/28 14:05:13 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.286 2022/08/03 08:11:18 claudio Exp $ */
/*
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
case AID_INET:
kr = kroute_match(kt, &kn->nexthop, 0);
- if (kr) {
+ if (kr != NULL) {
kn->kroute = kr;
+ kn->ifindex = kr->ifindex;
kr->flags |= F_NEXTHOP;
}
* the route remains the same then the NH state has not
* changed. State changes are tracked by knexthop_track().
*/
- if (kr != oldk) {
- kn->ifindex = kr->ifindex;
+ if (kr != oldk)
knexthop_send_update(kn);
- }
break;
case AID_INET6:
kr6 = kroute6_match(kt, &kn->nexthop, 0);
- if (kr6) {
+ if (kr6 != NULL) {
kn->kroute = kr6;
+ kn->ifindex = kr6->ifindex;
kr6->flags |= F_NEXTHOP;
}
- if (kr6 != oldk) {
- kn->ifindex = kr6->ifindex;
+ if (kr6 != oldk)
knexthop_send_update(kn);
- }
break;
}
}
}
kn->kroute = NULL;
+ kn->ifindex = 0;
}
/*