Topic: "Any-IP" feature

I am trying to get the AnyIP part working on Chillispot.  The FAQ, point "There is a patch by Alexander available on the forum which will enable the "Any-IP" feature."  Online searches point to a patch that once existed in the old forums.  I am running version 1.0-6 of Chillispot on Debian Lenny.  Do I need this patch with this version?  If I do need a patch, where could I get it, and how do I make it work?  Is this patch incorporated in 1.10?

Currently I have everything working corrently as long as Chillispot is the DHCP server.

Any help would be appreciated.

Steve

Re: "Any-IP" feature

I think there is an archive of the old site somewhere, it might include the old forums, im also keen on using/testing it.

Re: "Any-IP" feature

Here you are, patch this with the chillispot source, i found it here   http://coova.org/phpBB3/viewtopic.php?f=4&t=60&sid=f4f80d1d7fdcb659fa8db141288bfe6b&start=0

---------------------------------------------------------------------------------------------

diff -urNp old/chilli.c new/chilli.c
--- old/chilli.c   2007-01-04 10:22:03.000000000 +0100
+++ new/chilli.c   2007-01-04 10:22:15.000000000 +0100
@@ -3072,6 +3072,15 @@ int cb_dhcp_request(struct dhcp_conn_t *
   if (appconn->dnprot == DNPROT_DHCP_NONE)
     appconn->dnprot = DNPROT_UAM;

+  /* ALPAPAD */
+  /* Add routing entry ;-) */
+  if(ipm->inuse == 2)
+  {
+      struct in_addr mask;
+      mask.s_addr = 0xffffffff;
+      printf("Adding route: %d\n", tun_addroute(tun,addr,&appconn->ourip,&mask));
+  }
+
   return 0;
}

@@ -3150,11 +3159,20 @@ int cb_dhcp_disconnect(struct dhcp_conn_

   conn->authstate = DHCP_AUTH_NONE; /* TODO: Redundant */

-  if (appconn->uplink)
+  /* ALPAPAD */
+  if (appconn->uplink) {
+    struct ippoolm_t *member;
+    member = (struct ippoolm_t *) appconn->uplink;
+    if(member->inuse  == 2) {
+         struct in_addr mask;
+         mask.s_addr = 0xffffffff;
+         printf("Removing route: %d\n", tun_delroute(tun,&member->addr,&appconn->ourip,&mask,1));
+    }
     if (ippool_freeip(ippool, (struct ippoolm_t *) appconn->uplink)) {
       sys_err(LOG_ERR, __FILE__, __LINE__, 0,
          "ippool_freeip() failed!");
     }
+    }
   
   (void) freeconn(appconn);

diff -urNp old/dhcp.c new/dhcp.c
--- old/dhcp.c   2007-01-04 10:22:03.000000000 +0100
+++ new/dhcp.c   2007-01-04 10:22:15.000000000 +0100
@@ -2027,16 +2027,26 @@ int dhcp_receive_ip(struct dhcp_t *this,
     ourip.s_addr = conn->ourip.s_addr;
   }
   else {
-    if (this->debug) printf("Address not found\n");
+    /* ALPAPAD */
+    struct in_addr reqaddr;
+    /* Get local copy */
+    memcpy(&reqaddr.s_addr, &pack->iph.saddr, DHCP_IP_ALEN);
+    if (this->debug) printf("Address not found (%s)\n",inet_ntoa(reqaddr));
+    /* Allocate new connection */
+    if (dhcp_newconn(this, &conn, pack->ethh.src))
+      return 0; /* Out of connections */
+
+    /* Request an IP address */
+    if (conn->authstate == DHCP_AUTH_NONE) {
+       this->cb_request(conn,&reqaddr);
+    }
+
+
     ourip.s_addr = this->ourip.s_addr;
     
     /* Do we allow dynamic allocation of IP addresses? */
     if (!this->allowdyn)
       return 0;
-   
-    /* Allocate new connection */
-    if (dhcp_newconn(this, &conn, pack->ethh.src))
-      return 0; /* Out of connections */
   }

   /* Request an IP address */
@@ -2207,10 +2217,11 @@ int dhcp_sendARP(struct dhcp_conn_t *con
   if (conn->hisip.s_addr == reqaddr.s_addr)
     return 0;

+  /* aNt1X: Commented out, we don't know his mask, we have to answer to every ARP request (AnyIP)
   /* If ARP request outside of mask: Ignore */
-  if ((conn->hisip.s_addr & conn->hismask.s_addr) !=
+  /*if ((conn->hisip.s_addr & conn->hismask.s_addr) !=
       (reqaddr.s_addr & conn->hismask.s_addr))
-    return 0;
+    return 0;*/

   /* Get packet default values */
   memset(&packet, 0, sizeof(packet));
@@ -2255,23 +2266,33 @@ int dhcp_receive_arp(struct dhcp_t *this
   }


+  /* aNt1X: Commented out, so that Chillispot answers to every ARP request (AnyIP)
   /* Check that MAC address is our MAC or Broadcast */
-  if ((memcmp(pack->ethh.dst, this->hwaddr, DHCP_ETH_ALEN)) && (memcmp(pack->ethh.dst, bmac, DHCP_ETH_ALEN))) {
+  /*if ((memcmp(pack->ethh.dst, this->hwaddr, DHCP_ETH_ALEN)) && (memcmp(pack->ethh.dst, bmac, DHCP_ETH_ALEN))) {
     if (this->debug) printf("Received ARP request for other destination!\n");
     return 0;
-  }
+  }*/

   /* Check to see if we know MAC address. */
   if (dhcp_hashget(this, &conn, pack->ethh.src)) {
-    if (this->debug) printf("Address not found\n");
+    /* ALPAPAD */
+    struct in_addr reqaddr;
+    /* Get local copy */
+    memcpy(&reqaddr.s_addr, &pack->arp.spa, DHCP_IP_ALEN);
+    if (this->debug) printf("Address not found (%s)\n",inet_ntoa(reqaddr));
+    /* Allocate new connection */
+    if (dhcp_newconn(this, &conn, pack->ethh.src))
+      return 0; /* Out of connections */
+
+    /* Request an IP address */
+    if (conn->authstate == DHCP_AUTH_NONE) {
+       this->cb_request(conn,&reqaddr);
+    }
+
     
     /* Do we allow dynamic allocation of IP addresses? */
     if (!this->allowdyn)  /* TODO: Experimental */
       return 0;
-   
-    /* Allocate new connection */
-    if (dhcp_newconn(this, &conn, pack->ethh.src)) /* TODO: Experimental */
-      return 0; /* Out of connections */
   }
   
   
@@ -2282,7 +2303,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->hisip.s_addr, pack->arp.tpa, 4)) {
     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 -urNp old/ippool.c new/ippool.c
--- old/ippool.c   2007-01-04 10:22:03.000000000 +0100
+++ new/ippool.c   2007-01-04 10:22:15.000000000 +0100
@@ -393,7 +393,7 @@ int ippool_newip(struct ippool_t *this,
   }

   /* If not found yet and dynamic IP then allocate dynamic IP */
-  if ((!p2) && (!statip)) {
+if ((!p2) && (!statip) && (!addr->s_addr)) {
     if (!this ->firstdyn) {
       sys_err(LOG_ERR, __FILE__, __LINE__, 0,
          "No more IP addresses available");
@@ -431,7 +431,7 @@ int ippool_newip(struct ippool_t *this,
   /* It was not possible to allocate from dynamic address pool */
   /* Try to allocate from static address space */

-  if ((addr) && (addr->s_addr) && (statip)) { /* IP address given */
+  if ((addr) && (addr->s_addr)) { /* IP address given */
     if (!this->firststat) {
       sys_err(LOG_ERR, __FILE__, __LINE__, 0,
          "No more IP addresses available");


---------------------------------------------------------------------------------------------

wink

Re: "Any-IP" feature

I saved the patch posted in the forum into a file called patch.

I copyed the file to the server, and ran the command.

patch -p0 < patch
(Stripping trailing CRs from patch.)
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urNp old/chilli.c new/chilli.c
|--- old/chilli.c   2007-01-04 10:22:03.000000000 +0100
|+++ new/chilli.c   2007-01-04 10:22:15.000000000 +0100
--------------------------
File to patch:

I don't have a file called chilli.c

not sure what to do next, any help would be appreciated.