From: renato Date: Thu, 22 Oct 2015 23:17:45 +0000 (+0000) Subject: Fix some bugs in the handling of the RTM_GET and RTM_CHANGE messages X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4f0b209297f5c6e26908858249644cbe5c704d94;p=openbsd Fix some bugs in the handling of the RTM_GET and RTM_CHANGE messages found when running eigrpd(8) and ldpd(8) together. --- 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 @@ -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); }