Blob Blame History Raw
commit 479fb8e5aca35c757f234dc646fb0358509cb786
Author: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Date:   Tue Dec 14 21:41:02 2010 +0100

    set SO_REUSEADDR for client sockets
    
    This allows to run dhcp-forwarder and a dhcp server like dnsmasq (with
    'bind-interfaces' option) on the same host.
    
    Patch was provided by Stefan Keller <sk@open.ch>.

diff --git a/src/cfg.c b/src/cfg.c
index 24cd9ea..04e171d 100644
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -1,4 +1,4 @@
-// Copyright (C) 2002, 2003, 2004, 2008
+// Copyright (C) 2002, 2003, 2004, 2008, 2010
 //               Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -93,6 +93,8 @@ initClientFD(struct FdInfo *fd,
   Esetsockopt(fd->fd, SOL_SOCKET, SO_BINDTODEVICE, iface->name,
 	      MAX(strlen(iface->name)+1,sizeof(int)));
 
+  Esetsockopt(fd->fd, SOL_SOCKET, SO_REUSEADDR, &ON, sizeof ON);
+
   memset(&s, 0, sizeof(s));
 
     /*@-type@*/