1--- src/racoon/isakmp_var.h.orig 2010-11-12 16:36:37.000000000 +0600 2+++ src/racoon/isakmp_var.h 2018-04-27 22:15:58.249644000 +0700 3@@ -128,7 +128,7 @@ 4 #endif 5 6 extern int copy_ph1addresses __P(( struct ph1handle *, 7- struct remoteconf *, struct sockaddr *, struct sockaddr *)); 8+ struct remoteconf *, struct sockaddr *, struct sockaddr *, int)); 9 extern void log_ph1established __P((const struct ph1handle *)); 10 11 extern void script_hook __P((struct ph1handle *, int)); 12--- src/racoon/isakmp.c.orig 2018-04-27 22:13:23.465260000 +0700 13+++ src/racoon/isakmp.c 2018-04-27 22:20:44.865139000 +0700 14@@ -1075,7 +1075,7 @@ isakmp_ph1begin_i(rmconf, remote, local) 15 iph1->approval = NULL; 16 17 /* XXX copy remote address */ 18- if (copy_ph1addresses(iph1, rmconf, remote, local) < 0) { 19+ if (copy_ph1addresses(iph1, rmconf, remote, local, 1) < 0) { 20 delph1(iph1); 21 return NULL; 22 } 23@@ -1190,7 +1190,7 @@ isakmp_ph1begin_r(msg, remote, local, et 24 25 /* copy remote address; remote and local always contain 26 * port numbers so rmconf is not needed */ 27- if (copy_ph1addresses(iph1, NULL, remote, local) < 0) { 28+ if (copy_ph1addresses(iph1, NULL, remote, local, 0) < 0) { 29 delph1(iph1); 30 return -1; 31 } 32@@ -2906,10 +2906,11 @@ isakmp_printpacket(msg, from, my, decode 33 #endif /*HAVE_PRINT_ISAKMP_C*/ 34 35 int 36-copy_ph1addresses(iph1, rmconf, remote, local) 37+copy_ph1addresses(iph1, rmconf, remote, local, initiator) 38 struct ph1handle *iph1; 39 struct remoteconf *rmconf; 40 struct sockaddr *remote, *local; 41+ int initiator; 42 { 43 u_int16_t port; 44 45@@ -2925,7 +2926,7 @@ copy_ph1addresses(iph1, rmconf, remote, 46 * if remote has port # (in case of responder - from recvfrom(2)) 47 * respect content of "remote". 48 */ 49- if (extract_port(iph1->remote) == 0) { 50+ if (initiator || extract_port(iph1->remote) == 0) { 51 port = 0; 52 if (rmconf != NULL) 53 port = extract_port(rmconf->remote); 54--- src/racoon/isakmp_inf.c.orig 2018-04-27 22:13:23.482870000 +0700 55+++ src/racoon/isakmp_inf.c 2018-04-27 22:21:27.080881000 +0700 56@@ -725,7 +725,7 @@ isakmp_info_send_nx(isakmp, remote, loca 57 #endif 58 59 /* copy remote address */ 60- if (copy_ph1addresses(iph1, NULL, remote, local) < 0) 61+ if (copy_ph1addresses(iph1, NULL, remote, local, 0) < 0) 62 goto end; 63 64 tlen = sizeof(*n) + spisiz; 65