projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d3f889c
)
- Fixed IPv6 subnet lookup routine.
author
Guus Sliepen
<guus@tinc-vpn.org>
Sun, 7 Jan 2001 20:19:08 +0000
(20:19 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Sun, 7 Jan 2001 20:19:08 +0000
(20:19 +0000)
src/subnet.c
patch
|
blob
|
history
diff --git
a/src/subnet.c
b/src/subnet.c
index
ab881f4
..
a08e2de
100644
(file)
--- a/
src/subnet.c
+++ b/
src/subnet.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: subnet.c,v 1.1.2.1
7 2001/01/07 17:09:06
guus Exp $
+ $Id: subnet.c,v 1.1.2.1
8 2001/01/07 20:19:08
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-288,15
+288,21
@@
cp
subnet_t *lookup_subnet_ipv6(ipv6_t *address)
{
subnet_t *lookup_subnet_ipv6(ipv6_t *address)
{
- subnet_t subnet;
+ subnet_t subnet, *p;
+ int i;
cp
subnet.type = SUBNET_IPV6;
memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t));
memset(&subnet.net.ipv6.mask, 0xFF, 16);
cp
subnet.type = SUBNET_IPV6;
memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t));
memset(&subnet.net.ipv6.mask, 0xFF, 16);
-/* FIXME: check if it REALLY matches */
+ p = (subnet_t *)avl_search_closest_greater(subnet_tree, &subnet);
+
+ if(p)
+ for(i=0; i<8; i++)
+ if((address->x[i] & p->net.ipv6.address.x[i]) != p->net.ipv6.address.x[i])
+ return NULL;
- return
(subnet_t *)avl_search_closest_greater(subnet_tree, &subnet)
;
+ return
p
;
}
void dump_subnet_list(void)
}
void dump_subnet_list(void)