summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-03-26 23:04:35 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-03-26 23:04:35 +0000
commite109f3b024b08e2f8d460bedaa067fe9ce307458 (patch)
treee5a12001b64a9edf40ee58f67cbe3332caec50d3 /usr.sbin
parentdc884df0fac5b83fbadd662684565b7719b97af8 (diff)
inet_addr("127.0.0.1") -> htonl(INADDR_LOOPBACK)
Use IN_CLASSA_NET instead of hard coded 0xff000000 OK henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/config.c4
-rw-r--r--usr.sbin/bgpd/kroute.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 01977f84a94..31f72ff775e 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.42 2005/03/23 22:26:34 claudio Exp $ */
+/* $OpenBSD: config.c,v 1.43 2005/03/26 23:04:34 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -79,7 +79,7 @@ get_bgpid(void)
struct ifaddrs *ifap, *ifa;
u_int32_t ip = 0, cur, localnet;
- localnet = inet_addr("127.0.0.0");
+ localnet = htonl(INADDR_LOOPBACK & IN_CLASSA_NET);
if (getifaddrs(&ifap) == -1)
fatal("getifaddrs");
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index af39bd1bc53..aa5d3510c55 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.117 2005/03/15 10:18:39 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.118 2005/03/26 23:04:34 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -200,8 +200,8 @@ kr_change(struct kroute *kroute)
}
/* nexthop within 127/8 -> ignore silently */
- if ((kroute->nexthop.s_addr & htonl(0xff000000)) ==
- inet_addr("127.0.0.0"))
+ if ((kroute->nexthop.s_addr & htonl(IN_CLASSA_NET)) ==
+ htonl(INADDR_LOOPBACK & IN_CLASSA_NET))
return (0);
if (send_rtmsg(kr_state.fd, action, kroute) == -1)
@@ -247,8 +247,8 @@ kr_delete(struct kroute *kroute)
return (0);
/* nexthop within 127/8 -> ignore silently */
- if ((kroute->nexthop.s_addr & htonl(0xff000000)) ==
- inet_addr("127.0.0.0"))
+ if ((kroute->nexthop.s_addr & htonl(IN_CLASSA_NET)) ==
+ htonl(INADDR_LOOPBACK & IN_CLASSA_NET))
return (0);
if (send_rtmsg(kr_state.fd, RTM_DELETE, kroute) == -1)
@@ -869,7 +869,7 @@ protect_lo(void)
log_warn("protect_lo");
return (-1);
}
- kr->r.prefix.s_addr = inet_addr("127.0.0.1");
+ kr->r.prefix.s_addr = htonl(INADDR_LOOPBACK);
kr->r.prefixlen = 8;
kr->r.flags = F_KERNEL|F_CONNECTED;