A million changes, tunl0 was only ever used for checking if the ipip module is loaded. So, Instead of trying to modify it to check if it exists, We now just use get tunnel. We improved some errors and added some of our own. We made more changes than I can remember right now, Please enjoy.

This commit is contained in:
MissValeska 2014-03-17 21:42:37 -07:00
parent 415d789b80
commit b28ac22fb3
5 changed files with 66 additions and 67 deletions

View File

@ -306,16 +306,16 @@ void init_internet_gateway_search(void)
/* /*
* Bring tunl0 up (just to test if the ipip module is loaded) * Bring tunl0 up (just to test if the ipip module is loaded)
*/ */
loginfo("Configuring the \"" DEFAULT_TUNL_IF "\" tunnel device"); loginfo("Checking if \"" DEFAULT_TUNL_IF "\" exists");
if(tunnel_change(0, 0, 0, DEFAULT_TUNL_PREFIX, DEFAULT_TUNL_NUMBER) < 0) { if(tunnel_change(0, 0, 0, DEFAULT_TUNL_PREFIX, DEFAULT_TUNL_NUMBER) < 0) {
printf("Cannot initialize \"" DEFAULT_TUNL_IF "\". " printf("Cannot read \"" DEFAULT_TUNL_IF "\". "
"Is the \"ipip\" kernel module loaded?\n" "Is the \"ipip\" kernel module loaded?\n"
" If you don't care about using the shared internet " " If you don't care about using the shared internet "
"connections of the ntk nodes\n" "connections of the ntk nodes\n"
" around you, disable the \"use_shared_inet\" option " " around you, disable the \"use_shared_inet\" option "
"in netsukuku.conf"); "in netsukuku.conf");
//del_resolv_conf("nameserver 127.0.0.1", "/etc/resolv.conf"); del_resolv_conf("nameserver 127.0.0.1", "/etc/resolv.conf");
//exit(1); exit(1);
} }
ifs_del_all_name(me.cur_ifs, &me.cur_ifs_n, NTK_TUNL_PREFIX); ifs_del_all_name(me.cur_ifs, &me.cur_ifs_n, NTK_TUNL_PREFIX);
ifs_del_all_name(me.cur_ifs, &me.cur_ifs_n, DEFAULT_TUNL_PREFIX); ifs_del_all_name(me.cur_ifs, &me.cur_ifs_n, DEFAULT_TUNL_PREFIX);

View File

@ -1055,6 +1055,7 @@ ssize_t inet_sendto(int s, const void *msg, size_t len, int flags,
int ret; int ret;
if((err=sendto(s, msg, len, flags, to, tolen))==-1) { if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
error("sendto errno: %d err is: %d", errno, err);
switch(errno) switch(errno)
{ {
case EMSGSIZE: case EMSGSIZE:

View File

@ -56,8 +56,7 @@ int tunnel_add(inet_prefix *remote, inet_prefix *local, char *dev,
int tunnel_change(inet_prefix *remote, inet_prefix *local, char *dev, int tunnel_change(inet_prefix *remote, inet_prefix *local, char *dev,
char *tunl_prefix, int tunl_number) char *tunl_prefix, int tunl_number)
{ {
error("The value of siocchgtunnel is: %d", SIOCCHGTUNNEL); return do_add(SIOCGETTUNNEL, remote, local, dev, tunl_prefix,
return do_add(SIOCCHGTUNNEL, remote, local, dev, tunl_prefix,
tunl_number); tunl_number);
} }
@ -248,7 +247,6 @@ int do_get(char *dev)
static int do_add(int cmd, inet_prefix *remote, inet_prefix *local, char *dev, static int do_add(int cmd, inet_prefix *remote, inet_prefix *local, char *dev,
char *tunl_prefix, int tunl_number) char *tunl_prefix, int tunl_number)
{ {
error("This is the do_add function.");
struct ip_tunnel_parm p; struct ip_tunnel_parm p;
if (fill_tunnel_parm(cmd, remote, local, dev, tunl_prefix, if (fill_tunnel_parm(cmd, remote, local, dev, tunl_prefix,

View File

@ -22,8 +22,8 @@
#include "if.h" #include "if.h"
#define DEFAULT_TUNL_PREFIX "tunl" #define DEFAULT_TUNL_PREFIX "tunl"
#define DEFAULT_TUNL_NUMBER 1 /* The permanent tunl0 device */ #define DEFAULT_TUNL_NUMBER 0 /* The permanent tunl0 device */
#define DEFAULT_TUNL_IF "tunl1" #define DEFAULT_TUNL_IF "tunl0"
#define NTK_TUNL_PREFIX "ntk_tunl" #define NTK_TUNL_PREFIX "ntk_tunl"
/* Usage: printf(TUNL_STRING, TUNL_NUMBER("tunl", x)); */ /* Usage: printf(TUNL_STRING, TUNL_NUMBER("tunl", x)); */

View File

@ -105,7 +105,7 @@ int commit_rules(iptc_handle_t *t)
{ {
int res; int res;
res=iptc_commit(t); res=iptc_commit(t);
error("This is the value of res: %i This is the value of t is: %s", res, t); error("This is the value of res: %i This is the value of t is: %p", res, t);
if (!res) { if (!res) {
error("In commit_rules: %s.",iptc_strerror(errno)); error("In commit_rules: %s.",iptc_strerror(errno));
err_ret(ERR_NETCOM,-1); err_ret(ERR_NETCOM,-1);