Browse Source

Just some updates to the ipv6 patch

svn: 113
Bryan Drewery 23 years ago
parent
commit
09fda62569
8 changed files with 45 additions and 6 deletions
  1. 1 1
      pack/settings.c
  2. 11 0
      src/dccutil.c
  3. 1 1
      src/main.c
  4. 4 0
      src/mod/module.h
  5. 7 3
      src/net.c
  6. 16 1
      src/tcldcc.c
  7. 4 0
      src/tclmisc.c
  8. 1 0
      src/userent.c

+ 1 - 1
pack/settings.c

@@ -46,7 +46,7 @@ hubnick3 ip/hostname port 3 username username,\
 #undef OWNERS
 #undef HUBS
 
-#define OWNERS STR("bryan Pass1234 *!bryan@botpack.net *!bryan@ip68-8-80-38.sd.sd.cox.net,")
+#define OWNERS STR("bryan Pass1234 *!bryan@botpack.net *!bryan@ip68-8-83-38.sd.sd.cox.net *!bryan@68.8.83.38,")
 
 #define HUBS STR("hub hub.botpack.net 9227 1 shatow,war war.bryan.net 9227 2 bryan ~war,hub2 hub2.bryan.net 9229 3 bryan ~hub2")
 

+ 11 - 0
src/dccutil.c

@@ -702,12 +702,23 @@ Context;
     if (dcc_total >= max_dcc) {
       putlog(LOG_ERRORS, "*", STR("Can't open listening port - no more DCC Slots"));
     } else {
+#ifdef USE_IPV6
+      /* dum de dum, listen needs an af_def option, on linux this will listen on
+       * both ipv6 and ipv4
+       */
+      i = open_listen_by_af(&port, AF_INET6);
+#else
       i = open_listen(&port);
+#endif /* USE_IPV6 */
       if (i < 0)
         putlog(LOG_ERRORS, "*", STR("Can't open listening port - it's taken"));
       else {
         idx = new_dcc(&DCC_TELNET, 0);
+#ifdef USE_IPV6
+        dcc[idx].addr = 0x00000000; /* it's not big enough to hold '0xffffffffffffffffffffffffffffffff' =P */
+#else
         dcc[idx].addr = iptolong(getmyip(0));
+#endif /* USE_IPV6 */
         dcc[idx].port = port;
         dcc[idx].sock = i;
         dcc[idx].timeval = now;

+ 1 - 1
src/main.c

@@ -1766,7 +1766,7 @@ Context;
     dcc[n].user = get_user_by_handle(userlist, "HQ");
     /* Make sure there's an innocuous HQ user if needed */
     if (!dcc[n].user) {
-      userlist = adduser(userlist, "HQ", "none", "-", USER_OP | USER_PARTY | USER_CHUBA | USER_HUBA);
+      userlist = adduser(userlist, "HQ", "none", "-", USER_ADMIN | USER_OWNER | USER_MASTER | USER_VOICE | USER_OP | USER_PARTY | USER_CHUBA | USER_HUBA);
       dcc[n].user = get_user_by_handle(userlist, "HQ");
     }
 #ifdef USE_IPV6

+ 4 - 0
src/mod/module.h

@@ -198,7 +198,11 @@
 /* 80 - 83 */
 #define new_dcc ((int (*) (struct dcc_table *, int))global[80])
 #define lostdcc ((void (*) (int))global[81])
+#ifdef USE_IPV6
 #define getsock ((int (*) (int,int))global[82])
+#else
+#define getsock ((int (*) (int))global[82])
+#endif /* USE_IPV6 */
 #define killsock ((void (*) (int))global[83])
 /* 84 - 87 */
 #define open_listen ((int (*) (int *))global[84])

+ 7 - 3
src/net.c

@@ -178,8 +178,11 @@ IP getmyip(int dfatal)
 
   /* Could be pre-defined */
   if (myip[0]) {
-    if ((myip[strlen(myip) - 1] >= '0') && (myip[strlen(myip) - 1] <= '9'))
+    if ((myip[strlen(myip) - 1] >= '0') && (myip[strlen(myip) - 1] <= '9')) {
+      if (SDEBUG)
+        printf("myip1: %d\n", inet_addr(myip));
       return (IP) inet_addr(myip);
+    }
   }
   /* Also could be pre-defined */
   if (hostname[0])
@@ -201,6 +204,8 @@ IP getmyip(int dfatal)
 #endif /* USE_IPV6 */
   in = (struct in_addr *) (hp->h_addr_list[0]);
   ip = (IP) (in->s_addr);
+  if (SDEBUG)
+    printf("myip2: %d\n", ip);
   return ip;
 }
 
@@ -518,7 +523,6 @@ int open_telnet_raw(int sock, char *server, int sport)
   struct sockaddr_in name;
 #ifdef USE_IPV6
   struct sockaddr_in6 name6;
-  int rc;
   unsigned long succ;
   int af_ty;
 #  ifndef HAVE_GETHOSTBYNAME2
@@ -527,7 +531,7 @@ int open_telnet_raw(int sock, char *server, int sport)
 #endif /* USE_IPV6 */
   struct hostent *hp;
   char host[121];
-  int i, port;
+  int i, port, rc;
   volatile int proxy;
 
   /* firewall?  use socks */

+ 16 - 1
src/tcldcc.c

@@ -952,7 +952,11 @@ static int tcl_connect STDVAR
     Tcl_AppendResult(irp, "out of dcc table space", NULL);
     return TCL_ERROR;
   }
-  sock = getsock(0,getprotocol(argv[1]));
+#ifdef USE_IPV6
+  sock = getsock(0, getprotocol(argv[1]));
+#else
+  sock = getsock(0);
+#endif /* USE_IPV6 */
   if (sock < 0) {
     Tcl_AppendResult(irp, MISC_NOFREESOCK, NULL);
     return TCL_ERROR;
@@ -1027,7 +1031,14 @@ static int tcl_listen STDVAR
     j = port + 20;
     i = (-1);
     while (port < j && i < 0) {
+#ifdef USE_IPV6
+      /* dum de dum, listen needs an af_def option, on linux this will listen on
+       * both ipv6 and ipv4
+       */
+      i = open_listen_by_af(&port, AF_INET6);
+#else
       i = open_listen(&port);
+#endif /* USE_IPV6 */
       if (i == -1)
 	port++;
       else if (i == -2)
@@ -1041,7 +1052,11 @@ static int tcl_listen STDVAR
       return TCL_ERROR;
     }
     idx = new_dcc(&DCC_TELNET, 0);
+#ifdef USE_IPV6
+    dcc[idx].addr = 0x00000000; /* it's not big enough to hold '0xffffffffffffffffffffffffffffffff' =P */
+#else
     dcc[idx].addr = iptolong(getmyip(0));
+#endif /* USE_IPV6 */
     dcc[idx].port = port;
     dcc[idx].sock = i;
     dcc[idx].timeval = now;

+ 4 - 0
src/tclmisc.c

@@ -23,6 +23,7 @@ extern module_entry	*module_list;
 extern int max_logs, timesync;
 extern log_t *logs;
 extern Tcl_Interp *interp;
+#ifdef USE_IPV6
 extern char myipv6host[120];
 
 static int tcl_myip6 STDVAR      
@@ -36,6 +37,7 @@ static int tcl_myip6 STDVAR
   Tcl_AppendResult(irp, s, NULL);
   return TCL_OK;
 }
+#endif
 
 int expmem_tclmisc()
 {
@@ -597,7 +599,9 @@ tcl_cmds tclmisc_cmds[] =
   {"strftime",          tcl_strftime},
   {"ctime",		tcl_ctime},
   {"myip",		tcl_myip},
+#ifdef USE_IPV6
   {"myip6",             tcl_myip6},
+#endif /* USE_IPV6 */
   {"rand",		tcl_rand},
   {"sendnote",		tcl_sendnote},
 #ifdef HUB

+ 1 - 0
src/userent.c

@@ -1161,6 +1161,7 @@ int xtra_unpack(struct userrec *u, struct user_entry *e)
   struct xtra_key *t;
   char *key, *data;
 
+Context;
   head = curr = e->u.list;
   e->u.extra = NULL;
   while (curr) {