aboutsummaryrefslogtreecommitdiffstats
path: root/main/ipsec-tools/03-fix-sport-selection.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/ipsec-tools/03-fix-sport-selection.patch')
-rw-r--r--main/ipsec-tools/03-fix-sport-selection.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/ipsec-tools/03-fix-sport-selection.patch b/main/ipsec-tools/03-fix-sport-selection.patch
new file mode 100644
index 0000000000..56cd999b39
--- /dev/null
+++ b/main/ipsec-tools/03-fix-sport-selection.patch
@@ -0,0 +1,29 @@
+--- a/src/racoon/grabmyaddr.c 14 Mar 2011 17:18:12 -0000 1.28
++++ b/src/racoon/grabmyaddr.c 5 Feb 2013 11:32:59 -0000
+@@ -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;
++ }
+ }
++
++ if (port == 0)
++ port = PORT_ISAKMP;
+
+- return PORT_ISAKMP;
++ return port;
+ }
+
+ void