-/* $OpenBSD: kroute.c,v 1.3 2015/10/21 03:52:12 renato Exp $ */
+/* $OpenBSD: kroute.c,v 1.4 2015/10/22 23:17:45 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
kprio = kroute_find_prio(kp, kr.priority);
if (kprio) {
kn = TAILQ_FIRST(&kprio->nexthops);
- if (kn && (kn->r.flags & F_KERNEL))
- kroute_remove(&kr);
+ if (kn)
+ kroute_remove(&kn->r);
}
}
}
return (-1);
}
- if (kr.priority == eigrpd_conf->fib_priority_internal ||
- kr.priority == eigrpd_conf->fib_priority_external ||
- kr.priority == eigrpd_conf->fib_priority_summary) {
- log_warnx("alien EIGRP route %s/%d", log_addr(kr.af, &kr.prefix),
- kr.prefixlen);
- return (send_rtmsg(kr_state.fd, RTM_DELETE, &kr));
- }
-
if (kn != NULL) {
/* update route */
memcpy(&kn->r, &kr, sizeof(kn->r));
kn->r.flags |= F_DOWN;
kr_redistribute(kp);
- } else
+ } else {
+ if ((rtm->rtm_type == RTM_ADD || rtm->rtm_type == RTM_GET) &&
+ (kr.priority == eigrpd_conf->fib_priority_internal ||
+ kr.priority == eigrpd_conf->fib_priority_external ||
+ kr.priority == eigrpd_conf->fib_priority_summary)) {
+ log_warnx("alien EIGRP route %s/%d", log_addr(kr.af,
+ &kr.prefix), kr.prefixlen);
+ return (send_rtmsg(kr_state.fd, RTM_DELETE, &kr));
+ }
+
kroute_insert(&kr);
+ }
return (0);
}