diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2011-01-18 11:34:45 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2011-01-18 11:34:45 +0000 |
commit | 681649ea0da8bc979e02b30c2e8396ca6faca30f (patch) | |
tree | b67932d55d60573d077669a45ee14756ea011969 | |
parent | fd13fe6199cf5f5ff82f2a2b122136a0eab13c14 (diff) |
reyk noticed that my rb-tree-fu is not that great. fixup compare function
to do exact matches; ok reyk
-rw-r--r-- | sbin/iked/policy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/iked/policy.c b/sbin/iked/policy.c index 54ef57f1ccd..e8e07dc8b54 100644 --- a/sbin/iked/policy.c +++ b/sbin/iked/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.13 2011/01/17 18:49:35 mikeb Exp $ */ +/* $OpenBSD: policy.c,v 1.14 2011/01/18 11:34:44 mikeb Exp $ */ /* $vantronix: policy.c,v 1.29 2010/05/28 15:34:35 reyk Exp $ */ /* @@ -432,11 +432,11 @@ static __inline int addr_cmp(struct iked_addr *a, struct iked_addr *b, int useports) { int diff = 0; - int prefix; - prefix = MAX(a->addr_mask, b->addr_mask); diff = sockaddr_cmp((struct sockaddr *)&a->addr, - (struct sockaddr *)&b->addr, prefix); + (struct sockaddr *)&b->addr, 128); + if (!diff) + diff = (int)a->addr_mask - (int)b->addr_mask; if (!diff && useports) diff = a->addr_port - b->addr_port; |