projects
/
project
/
odhcpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e9a21fd
)
Avoid some bloat
author
Steven Barth
<steven@midlink.org>
Tue, 18 Feb 2014 08:36:29 +0000
(09:36 +0100)
committer
Steven Barth
<steven@midlink.org>
Tue, 18 Feb 2014 08:36:29 +0000
(09:36 +0100)
src/router.c
patch
|
blob
|
history
diff --git
a/src/router.c
b/src/router.c
index
907011a
..
7a79119
100644
(file)
--- a/
src/router.c
+++ b/
src/router.c
@@
-186,20
+186,6
@@
static void handle_icmpv6(void *addr, void *data, size_t len,
}
}
-static bool match_route(const struct odhcpd_ipaddr *n, const struct in6_addr *addr)
-{
- if (n->prefix <= 32)
- return ntohl(n->addr.s6_addr32[0]) >> (32 - n->prefix) ==
- ntohl(addr->s6_addr32[0]) >> (32 - n->prefix);
-
- if (n->addr.s6_addr32[0] != addr->s6_addr32[0])
- return false;
-
- return ntohl(n->addr.s6_addr32[1]) >> (64 - n->prefix) ==
- ntohl(addr->s6_addr32[1]) >> (64 - n->prefix);
-}
-
-
// Detect whether a default route exists, also find the source prefixes
static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len)
{
// Detect whether a default route exists, also find the source prefixes
static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len)
{
@@
-224,7
+210,7
@@
static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len)
for (ssize_t i = 0; i < len; ++i) {
if (n[i].prefix <= 64 && n[i].prefix >= p.prefix &&
for (ssize_t i = 0; i < len; ++i) {
if (n[i].prefix <= 64 && n[i].prefix >= p.prefix &&
-
match_route(&p, &n[i].addr
)) {
+
!odhcpd_bmemcmp(&p.addr, &n[i].addr, p.prefix
)) {
n[i].prefix = p.prefix;
break;
}
n[i].prefix = p.prefix;
break;
}