Add the option "proxyarp" in the configuration file

diff -rNpu chillispot-1.1.0.orig/src/chilli.c chillispot-1.1.0/src/chilli.c
--- chillispot-1.1.0.orig/src/chilli.c    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/chilli.c    Mon Sep 21 15:55:25 2009
@@ -622,6 +622,9 @@ int static process_options(int argc, cha
     options.dhcpusemac  = 1;
   }
 
+  /* proxyarp                                                    */
+  options.proxyarp = args_info.proxyarp_flag;
+
   /* lease                                                           */
   options.lease = args_info.lease_arg;
 
@@ -1125,7 +1128,7 @@ void static reprocess_options(int argc, 
   (void) dhcp_set(dhcp, (options.debug & DEBUG_DHCP),
           options.uamserver, options.uamserverlen, options.uamanydns,
           options.uamokip, options.uamokiplen,
-          options.uamokaddr, options.uamokmask, options.uamoknetlen);
+          options.uamokaddr, options.uamokmask, options.uamoknetlen, options.proxyarp);
   
   /* Reinit RADIUS parameters */
   (void) radius_set(radius, (options.debug & DEBUG_RADIUS),
@@ -2880,7 +2883,7 @@ int radius_conf(struct radius_t *radius,
   (void) dhcp_set(dhcp, (options.debug & DEBUG_DHCP),
           options.uamserver, options.uamserverlen, options.uamanydns,
           options.uamokip, options.uamokiplen,
-          options.uamokaddr, options.uamokmask, options.uamoknetlen);
+          options.uamokaddr, options.uamokmask, options.uamoknetlen, options.proxyarp);
 }
 
 /* Radius callback when access accept/reject/challenge has been received */
@@ -3954,7 +3957,7 @@ int main(int argc, char **argv)
     if (dhcp_set(dhcp, (options.debug & DEBUG_DHCP),
          options.uamserver, options.uamserverlen, options.uamanydns,
          options.uamokip, options.uamokiplen,
-         options.uamokaddr, options.uamokmask, options.uamoknetlen)) {
+         options.uamokaddr, options.uamokmask, options.uamoknetlen, options.proxyarp)) {
       sys_err(LOG_ERR, __FILE__, __LINE__, 0,
           "Failed to set DHCP parameters");
       exit(1);
diff -rNpu chillispot-1.1.0.orig/src/chilli.h chillispot-1.1.0/src/chilli.h
--- chillispot-1.1.0.orig/src/chilli.h    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/chilli.h    Mon Sep 21 15:55:25 2009
@@ -273,6 +273,7 @@ struct options_t {
   /* DHCP parameters */
   int nodhcp;                    /* Do not use DHCP */
   char* dhcpif;                 /* Interface: eth0 */
+  int proxyarp;            /* Enable Local Proxy arp */
   unsigned char dhcpmac[DHCP_ETH_ALEN]; /* Interface MAC address */
   int dhcpusemac;               /* Use given MAC or interface default */
   struct in_addr dhcplisten;     /* IP address to listen to */
diff -rNpu chillispot-1.1.0.orig/src/cmdline.c chillispot-1.1.0/src/cmdline.c
--- chillispot-1.1.0.orig/src/cmdline.c    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/cmdline.c    Mon Sep 21 15:55:25 2009
@@ -100,6 +100,7 @@ void clear_given (struct gengetopt_args_
   args_info->confpassword_given = 0 ;
   args_info->dhcpif_given = 0 ;
   args_info->dhcpmac_given = 0 ;
+  args_info->proxyarp_given = 0 ;
   args_info->lease_given = 0 ;
   args_info->eapolenable_given = 0 ;
   args_info->uamserver_given = 0 ;
@@ -193,6 +194,7 @@ void clear_args (struct gengetopt_args_i
   args_info->dhcpif_orig = NULL;
   args_info->dhcpmac_arg = NULL;
   args_info->dhcpmac_orig = NULL;
+  args_info->proxyarp_flag = 0;
   args_info->lease_arg = 600;
   args_info->lease_orig = NULL;
   args_info->eapolenable_flag = 0;
@@ -272,6 +274,7 @@ cmdline_parser_print_help (void)
   printf("%s\n","      --confpassword=STRING     Password for remote config");
   printf("%s\n","      --dhcpif=STRING           Local Ethernet interface");
   printf("%s\n","      --dhcpmac=STRING          Interface MAC address");
+  printf("%s\n","      --proxyarp                Enable Local Proxy ARP");
   printf("%s\n","      --lease=INT               Lease time to allocate to clients  \n                                  (default=`600')");
   printf("%s\n","      --eapolenable             Enable IEEE 802.1x authentication  \n                                  (default=off)");
   printf("%s\n","      --uamserver=STRING        URL of authentication web server  \n                                  (default=`https://login.hotradius.com')");
@@ -1024,6 +1027,9 @@ cmdline_parser_file_save(const char *fil
       fprintf(outfile, "%s\n", "dhcpmac");
     }
   }
+  if (args_info->proxyarp_given) {
+    fprintf(outfile, "%s\n", "proxyarp");
+  }
   if (args_info->lease_given) {
     if (args_info->lease_orig) {
       fprintf(outfile, "%s=\"%s\"\n", "lease", args_info->lease_orig);
@@ -1286,6 +1292,7 @@ cmdline_parser_internal (int argc, char 
         { "confpassword",    1, NULL, 0 },
         { "dhcpif",    1, NULL, 0 },
         { "dhcpmac",    1, NULL, 0 },
+        { "proxyarp",    0, NULL, 0 },
         { "lease",    1, NULL, 0 },
         { "eapolenable",    0, NULL, 0 },
         { "uamserver",    1, NULL, 0 },
@@ -2028,6 +2035,20 @@ cmdline_parser_internal (int argc, char 
             if (args_info->dhcpmac_orig)
               free (args_info->dhcpmac_orig); /* free previous string */
             args_info->dhcpmac_orig = gengetopt_strdup (optarg);
+          }
+          /* Enable Local Proxy ARP.  */
+          else if (strcmp (long_options[option_index].name, "proxyarp") == 0)
+          {
+            if (local_args_info.proxyarp_given)
+              {
+                fprintf (stderr, "%s: `--proxyarp' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
+                goto failure;
+              }
+            if (args_info->proxyarp_given && ! override)
+              continue;
+            local_args_info.proxyarp_given = 1;
+            args_info->proxyarp_given = 1;
+            args_info->proxyarp_flag = !(args_info->proxyarp_flag);
           }
           /* Lease time to allocate to clients.  */
           else if (strcmp (long_options[option_index].name, "lease") == 0)
diff -rNpu chillispot-1.1.0.orig/src/cmdline.ggo chillispot-1.1.0/src/cmdline.ggo
--- chillispot-1.1.0.orig/src/cmdline.ggo    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/cmdline.ggo    Mon Sep 21 15:55:25 2009
@@ -97,6 +97,7 @@ option "confpassword" - "Password for re
 # DHCP parameters
 option "dhcpif"      - "Local Ethernet interface"    string no
 option "dhcpmac"     - "Interface MAC address"       string no
+option "proxyarp"    - "Local Proxy ARP"             flag no
 option "lease"       - "Lease time to allocate to clients" int default="600" no
 
 
diff -rNpu chillispot-1.1.0.orig/src/cmdline.h chillispot-1.1.0/src/cmdline.h
--- chillispot-1.1.0.orig/src/cmdline.h    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/cmdline.h    Mon Sep 21 15:55:25 2009
@@ -97,6 +97,7 @@ struct gengetopt_args_info
   char * confpassword_orig;    /* Password for remote config original value given at command line.  */
   char * dhcpif_arg;    /* Local Ethernet interface.  */
   char * dhcpif_orig;    /* Local Ethernet interface original value given at command line.  */
+  int proxyarp_flag;    /* Local Proxy Arp  (default=off). */
   char * dhcpmac_arg;    /* Interface MAC address.  */
   char * dhcpmac_orig;    /* Interface MAC address original value given at command line.  */
   int lease_arg;    /* Lease time to allocate to clients (default='600').  */
@@ -164,6 +165,7 @@ struct gengetopt_args_info
   int confpassword_given ;    /* Whether confpassword was given.  */
   int dhcpif_given ;    /* Whether dhcpif was given.  */
   int dhcpmac_given ;    /* Whether dhcpmac was given.  */
+  int proxyarp_given ;    /* Whether proxyarp was given.  */
   int lease_given ;    /* Whether lease was given.  */
   int eapolenable_given ;    /* Whether eapolenable was given.  */
   int uamserver_given ;    /* Whether uamserver was given.  */
diff -rNpu chillispot-1.1.0.orig/src/dhcp.c chillispot-1.1.0/src/dhcp.c
--- chillispot-1.1.0.orig/src/dhcp.c    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/dhcp.c    Mon Sep 21 15:55:39 2009
@@ -1208,13 +1208,14 @@ dhcp_set(struct dhcp_t *dhcp, int debug,
      struct in_addr *authip, int authiplen, int anydns,
      struct in_addr *uamokip, int uamokiplen, 
      struct in_addr *uamokaddr,
-     struct in_addr *uamokmask, int uamoknetlen) {
+     struct in_addr *uamokmask, int uamoknetlen, int proxyarp) {
 
   
   int i;
 
   dhcp->debug = debug;
   dhcp->anydns = anydns;
+  dhcp->proxyarp = proxyarp;
 
   /* Copy list of uamserver IP addresses */
   if ((dhcp)->authip) free((dhcp)->authip);
@@ -2359,7 +2360,7 @@ int dhcp_receive_arp(struct dhcp_t *this
     return 0; /* Only reply if he was allocated an address */
   }
   
-  if (memcmp(&conn->ourip.s_addr, pack->arp.tpa, 4)) {
+  if (memcmp(&conn->ourip.s_addr, pack->arp.tpa, 4) && !this->proxyarp) {
     if (this->debug) printf("Did not ask for router address: %.8x - %.2x%.2x%.2x%.2x\n", conn->ourip.s_addr, 
                 pack->arp.tpa[0],
                 pack->arp.tpa[1],
diff -rNpu chillispot-1.1.0.orig/src/dhcp.h chillispot-1.1.0/src/dhcp.h
--- chillispot-1.1.0.orig/src/dhcp.h    Sun Sep 24 23:48:25 2006
+++ chillispot-1.1.0/src/dhcp.h    Mon Sep 21 15:55:25 2009
@@ -384,6 +384,7 @@ struct dhcp_t {
   int arp_fd;           /* File descriptor to network interface */
   unsigned char arp_hwaddr[DHCP_ETH_ALEN]; /* Hardware address of interface */
   int arp_ifindex;      /* Hardware address of interface */
+  int proxyarp;        /* Enable proxy arp */
   int eapol_fd;         /* File descriptor to network interface */
   unsigned char eapol_hwaddr[DHCP_ETH_ALEN]; /* Hardware address of interface */
   int eapol_ifindex;    /* Hardware address of interface */
@@ -442,7 +443,7 @@ extern int
 dhcp_set(struct dhcp_t *dhcp, int debug,
      struct in_addr *authip, int authiplen, int anydns,
      struct in_addr *uamokip, int uamokiplen, struct in_addr *uamokaddr,
-     struct in_addr *uamokmask, int uamoknetlen);
+     struct in_addr *uamokmask, int uamoknetlen, int proxyarp);
 
 extern int
 dhcp_free(struct dhcp_t *dhcp);