From 15baa56a873d95ff185836d0cd661a775e202536 Mon Sep 17 00:00:00 2001 From: MissValeska Date: Sun, 16 Mar 2014 04:17:57 -0700 Subject: [PATCH] Oh my god! I fixed the tunl0 issues by renaming it to tunl1 and creating tunl1 on my system first, Amongst other things I don't remember. --- src/andns.c | 2 +- src/iptunnel.c | 39 +++++++++++++++++++++------------------ src/iptunnel.h | 10 +++++----- src/mark.c | 1 + 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/andns.c b/src/andns.c index 50e6224..af2efe5 100644 --- a/src/andns.c +++ b/src/andns.c @@ -603,7 +603,7 @@ int andns_gethostbyname(char *hname, inet_prefix *ip) error(err_str); err_ret(ERR_RSLRSL,-1); } - fprintf(stderr, "Addr is %p, rdata is %p\n", (void*)addr, (void*) dp->pkt_answ->rdata); + fprintf(stderr, "Addr is %p, rdata is %p rawr %p hai %p\n", (void*)&addr, (void*) dp->pkt_answ->rdata, (void*) dp->pkt_answ, (void*) dp); if ((dp == NULL) || (dp->pkt_answ == NULL) || (dp->pkt_answ->rdata == NULL)) return -1; memcpy(&addr, dp->pkt_answ->rdata, sizeof(uint32_t)); addr=ntohl(addr); diff --git a/src/iptunnel.c b/src/iptunnel.c index c7f10f2..8f0c46b 100644 --- a/src/iptunnel.c +++ b/src/iptunnel.c @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * -- - * This code derives from iproute2/iprule.c, it was modified to fit in + * This code derives from iproute2/iprule.c, it was modified to fit in * Netsukuku. * * Authors: Alexey Kuznetsov, @@ -49,13 +49,14 @@ int do_del(inet_prefix *remote, inet_prefix *local, char *dev, int tunnel_add(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number) { - return do_add(SIOCADDTUNNEL, remote, local, dev, tunl_prefix, + return do_add(SIOCADDTUNNEL, remote, local, dev, tunl_prefix, tunl_number); } int tunnel_change(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number) { + error("The value of siocchgtunnel is: %d", SIOCCHGTUNNEL); return do_add(SIOCCHGTUNNEL, remote, local, dev, tunl_prefix, tunl_number); } @@ -150,6 +151,7 @@ static int do_add_ioctl(int cmd, const char *basedev, struct ip_tunnel_parm *p) ifr.ifr_ifru.ifru_data = (void*)p; fd = socket(AF_INET, SOCK_DGRAM, 0); err = ioctl(fd, cmd, &ifr); + error("Socket File Descriptor Is: %i cmd is: %i err is: %i ifr is: %s Errno is: %d", fd, cmd, err, &ifr, errno); if (err) error(ERROR_MSG "ioctl: %s",ERROR_POS, strerror(errno)); close(fd); @@ -179,7 +181,7 @@ static int do_del_ioctl(const char *basedev, struct ip_tunnel_parm *p) * fill_tunnel_parm: fills the `p' struct. * `remote' and `local' must be in host order */ -static int fill_tunnel_parm(int cmd, inet_prefix *remote, inet_prefix *local, +static int fill_tunnel_parm(int cmd, inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number, struct ip_tunnel_parm *p) { @@ -229,7 +231,7 @@ static int fill_tunnel_parm(int cmd, inet_prefix *remote, inet_prefix *local, return 0; } -/* +/* * do_get: returns 1 if the tunnel named `dev' exists. */ int do_get(char *dev) @@ -246,9 +248,10 @@ int do_get(char *dev) static int do_add(int cmd, inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number) { + error("This is the do_add function."); 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, tunl_number, &p) < 0) return -1; @@ -258,7 +261,7 @@ static int do_add(int cmd, inet_prefix *remote, inet_prefix *local, char *dev, switch (p.iph.protocol) { case IPPROTO_IPIP: return do_add_ioctl(cmd, DEFAULT_TUNL_IF, &p); - default: + default: fatal("cannot determine tunnel mode (ipip, gre or sit)\n"); } return -1; @@ -276,14 +279,14 @@ int do_del(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix switch (p.iph.protocol) { case IPPROTO_IPIP: return do_del_ioctl(DEFAULT_TUNL_IF, &p); - default: + default: return do_del_ioctl(p.name, &p); } return -1; } /* - * tun_add_tunl: it adds in the `ifs' array a new struct which refers to + * tun_add_tunl: it adds in the `ifs' array a new struct which refers to * the tunnel "tunlX", where X is a number equal to `tunl'. */ int tun_add_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number) @@ -298,7 +301,7 @@ int tun_add_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number) return 0; } -/* +/* * tun_del_tunl: it removes from the `ifs' array, which must have at least * MAX_TUNNEL_IFS members, the struct which refers the tunnel "tunlX", where X * is a number equal to `tunl'. @@ -308,7 +311,7 @@ int tun_del_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number) { char tunl_name[IFNAMSIZ]; int i; - + sprintf(tunl_name, TUNL_STRING, TUNL_N(tunl_prefix, tunl_number)); for(i=0; i= MAX_MULTIPATH_ROUTES, - since in igs.c we are using a tunnel + since in igs.c we are using a tunnel for each nexthop inet-gw */ /* @@ -41,7 +41,7 @@ interface tunnel_ifs[MAX_TUNNEL_IFS]; -/* +/* * Functions declaration */ @@ -63,6 +63,6 @@ int add_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number, inet_prefix *tunl_ip); int del_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number); -void del_all_tunnel_ifs(inet_prefix *remote, inet_prefix *local, char *dev, +void del_all_tunnel_ifs(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix); #endif /* IPTUNNEL_H */ diff --git a/src/mark.c b/src/mark.c index 66c23cb..9ac1417 100644 --- a/src/mark.c +++ b/src/mark.c @@ -105,6 +105,7 @@ int commit_rules(iptc_handle_t *t) { int res; res=iptc_commit(t); + error("This is the value of res: %i This is the value of t is: %s", res, t); if (!res) { error("In commit_rules: %s.",iptc_strerror(errno)); err_ret(ERR_NETCOM,-1);