summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-02-26 15:50:21 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-02-26 15:50:21 +0000
commit676c8435f8b01ed928e57dd27ed6249aa2c99e6b (patch)
treea94bce95821aa114d57fc0863b9d25e07bb95313 /usr.sbin/bgpd
parent249db41974c310ab0e1ad517ce4868128b4acd77 (diff)
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.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/kroute.c8
1 files 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 <henning@openbsd.org>
@@ -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 */