Set REUSE option on sockets to prevent failures associated with closing and immediately re-opening. Submitted by Gabriel Somlo.

This commit is contained in:
mgrooms 2007-09-19 19:29:36 +00:00
parent f3ac6ef2b6
commit 26182f1f5d
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2007-09-19 Matthew Grooms <mgrooms@shrew.net>
From Gabriel Somlo <somlo@cmu.edu>
* src/racoon/isakmp.c: Set REUSE option on sockets to prevent failures
associated with closing and immediately re-opening.
2007-09-19 Matthew Grooms <mgrooms@shrew.net>
From Gabriel Somlo <somlo@cmu.edu>
* src/racoon/isakmp_unity.c: Prevent duplicate entries in splitnet list.

View File

@ -1,4 +1,4 @@
/* $NetBSD: isakmp.c,v 1.27 2007/07/18 12:07:51 vanhu Exp $ */
/* $NetBSD: isakmp.c,v 1.28 2007/09/19 19:29:36 mgrooms Exp $ */
/* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
@ -1724,6 +1724,20 @@ isakmp_open()
}
#endif
if (setsockopt(p->sock, SOL_SOCKET,
#ifdef __linux__
SO_REUSEADDR,
#else
SO_REUSEPORT,
#endif
(void *)&yes, sizeof(yes)) < 0) {
plog(LLV_ERROR, LOCATION, NULL,
"failed to set REUSE flag on %s (%s).\n",
saddr2str(p->addr), strerror(errno));
close(p->sock);
goto err_and_next;
}
if (setsockopt_bypass(p->sock, p->addr->sa_family) < 0)
goto err_and_next;