Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon Fix source port selection
details: https://anonhg.NetBSD.org/src/rev/adf1fd87b6ad
branches: trunk
changeset: 784668:adf1fd87b6ad
user: tteras <tteras%NetBSD.org@localhost>
date: Tue Feb 05 11:36:17 2013 +0000
description:
Fix source port selection
diffstat:
crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 0d357cccbdc2 -r adf1fd87b6ad crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c
--- a/crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c Tue Feb 05 11:31:56 2013 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/grabmyaddr.c Tue Feb 05 11:36:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grabmyaddr.c,v 1.29 2012/01/01 15:54:51 tteras Exp $ */
+/* $NetBSD: grabmyaddr.c,v 1.30 2013/02/05 11:36:17 tteras Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* Copyright (C) 2008 Timo Teras <timo.teras%iki.fi@localhost>.
@@ -274,13 +274,24 @@
struct sockaddr *addr;
{
struct myaddr *my;
+ int port = 0, wport;
LIST_FOREACH(my, &opened, chain) {
- if (cmpsaddr((struct sockaddr *) &my->addr, addr) <= CMPSADDR_WILDPORT_MATCH)
+ switch (cmpsaddr((struct sockaddr *) &my->addr, addr)) {
+ case CMPSADDR_MATCH:
return extract_port((struct sockaddr *) &my->addr);
+ case CMPSADDR_WILDPORT_MATCH:
+ wport = extract_port((struct sockaddr *) &my->addr);
+ if (port == 0 || wport < port)
+ port = wport;
+ break;
+ }
}
- return -1;
+ if (port == 0)
+ port = PORT_ISAKMP;
+
+ return port;
}
void
Home |
Main Index |
Thread Index |
Old Index