From 676c8435f8b01ed928e57dd27ed6249aa2c99e6b Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Fri, 26 Feb 2010 15:50:21 +0000 Subject: Fix some minor issues. 0 instead of NULL in one comparison. Set the right flags when protecting the IPv6 loopback addr (instead of reassigning the IPv4 ones) and install the IPv4 loopback blocker as 127/8 and not as 127.0.0.1/8. First two found by Hiroki Sato hrs (at) allbsd org and I found the 127/8 issue all by myself. --- usr.sbin/bgpd/kroute.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 98c1e9698b1..1cb0281bb0b 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.174 2010/02/23 16:06:04 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.175 2010/02/26 15:50:20 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -1073,7 +1073,7 @@ kroute6_matchgw(struct kroute6_node *kr, struct sockaddr_in6 *sa_in6) memcpy(&nexthop, &sa_in6->sin6_addr, sizeof(nexthop)); while (kr) { - if (memcmp(&kr->r.nexthop, &nexthop, sizeof(nexthop)) == NULL) + if (memcmp(&kr->r.nexthop, &nexthop, sizeof(nexthop)) == 0) return (kr); kr = kr->next; } @@ -1684,7 +1684,7 @@ protect_lo(void) log_warn("protect_lo"); return (-1); } - kr->r.prefix.s_addr = htonl(INADDR_LOOPBACK); + kr->r.prefix.s_addr = htonl(INADDR_LOOPBACK & IN_CLASSA_NET); kr->r.prefixlen = 8; kr->r.flags = F_KERNEL|F_CONNECTED; @@ -1698,7 +1698,7 @@ protect_lo(void) } memcpy(&kr6->r.prefix, &in6addr_loopback, sizeof(kr6->r.prefix)); kr6->r.prefixlen = 128; - kr->r.flags = F_KERNEL|F_CONNECTED; + kr6->r.flags = F_KERNEL|F_CONNECTED; if (RB_INSERT(kroute6_tree, &krt6, kr6) != NULL) free(kr6); /* kernel route already there, no problem */ -- cgit v1.2.3