summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/eigrpd/kroute.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/usr.sbin/eigrpd/kroute.c b/usr.sbin/eigrpd/kroute.c
index 869745f2c1f..88cb912c22a 100644
--- a/usr.sbin/eigrpd/kroute.c
+++ b/usr.sbin/eigrpd/kroute.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -1537,8 +1537,8 @@ rtmsg_process_route(struct rt_msghdr *rtm, struct sockaddr *rti_info[RTAX_MAX])
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);
}
}
}
@@ -1563,14 +1563,6 @@ rtmsg_process_route(struct rt_msghdr *rtm, struct sockaddr *rti_info[RTAX_MAX])
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));
@@ -1581,8 +1573,18 @@ rtmsg_process_route(struct rt_msghdr *rtm, struct sockaddr *rti_info[RTAX_MAX])
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);
}