1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu_test.c - AICCU Test function
7 ***********************************************************
9 $Id: aiccu_test.c,v 1.9 2007-01-15 12:00:46 jeroen Exp $
10 $Date: 2007-01-15 12:00:46 $
11 **********************************************************/
16 #define PING4 "ping -c %d -v %s 2>&1"
17 #define PING6 "ping6 -c %d -v %s 2>&1"
18 #define TRACEROUTE4 "traceroute %s 2>&1"
19 #define TRACEROUTE6 "traceroute6 %s 2>&1"
21 #define PING4 "ping -4 -n %d %s"
22 #define PING6 "ping -6 -n %d %s"
23 #define TRACEROUTE4 "tracert %s"
24 #define TRACEROUTE6 "tracert6 %s"
27 void system_arg(const char *fmt
, ...);
28 void system_arg(const char *fmt
, ...)
35 vsnprintf(buf
, sizeof(buf
), fmt
, ap
);
40 if (ret
== -1) dolog(LOG_WARNING
, "Execution of \"%s\" failed!? (Please check if the command is available)\n", buf
);
45 bool test_ask(bool automatic
);
46 bool test_ask(bool automatic
)
50 if (!g_aiccu
->running
) return false;
55 if (automatic
) return true;
57 printf("Did this work? [Y/n] ");
59 if (fgets(buf
, sizeof(buf
), stdin
) == NULL
) return false;
63 return (buf
[0] == 'N' || buf
[0] == 'n' ? false : true);
66 void aiccu_os_test(struct TIC_Tunnel
*hTunnel
, bool automatic
)
69 unsigned int tottests
= 8;
71 /* Make sure we have a correct local IPv4 address for some tests */
72 if (strcmp(hTunnel
->sType
, "6in4-static") != 0)
74 heartbeat_socket(NULL
, 0, "",
75 &hTunnel
->sIPv4_Local
,
80 if (!g_aiccu
->running
) return;
83 printf("####### AICCU Quick Connectivity Test\n");
84 printf("#######\n\n");
86 printf("####### [%u/%u] Ping the IPv4 Local/Your Outer Endpoint (%s)\n",
87 t
++, tottests
, hTunnel
->sIPv4_Local
);
88 printf("### This should return so called 'echo replies'\n");
89 printf("### If it doesn't then check your firewall settings\n");
90 printf("### Your local endpoint should always be pingable\n");
91 printf("### It could also indicate problems with your IPv4 stack\n");
93 system_arg(PING4
, PINGCOUNT
, hTunnel
->sIPv4_Local
);
94 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
96 printf("####### [%u/%u] Ping the IPv4 Remote/PoP Outer Endpoint (%s)\n",
97 t
++, tottests
, hTunnel
->sIPv4_POP
);
98 printf("### These pings should reach the PoP and come back to you\n");
99 printf("### In case there are problems along the route between your\n");
100 printf("### host and the PoP this could not return replies\n");
101 printf("### Check your firewall settings if problems occur\n");
103 system_arg(PING4
, PINGCOUNT
, hTunnel
->sIPv4_POP
);
104 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
106 printf("####### [%u/%u] Traceroute to the PoP (%s) over IPv4\n",
107 t
++, tottests
, hTunnel
->sIPv4_POP
);
108 printf("### This traceroute should reach the PoP\n");
109 printf("### In case this traceroute fails then you have no connectivity\n");
110 printf("### to the PoP and this is most probably the problem\n");
112 system_arg(TRACEROUTE4
, hTunnel
->sIPv4_POP
);
113 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
115 printf("###### [%u/%u] Checking if we can ping IPv6 localhost (::1)\n",
117 printf("### This confirms if your IPv6 is working\n");
118 printf("### If ::1 doesn't reply then something is wrong with your IPv6 stack\n");
120 system_arg(PING6
, PINGCOUNT
, "::1");
121 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
123 printf("###### [%u/%u] Ping the IPv6 Local/Your Inner Tunnel Endpoint (%s)\n",
124 t
++, tottests
, hTunnel
->sIPv6_Local
);
125 printf("### This confirms that your tunnel is configured\n");
126 printf("### If it doesn't reply then check your interface and routing tables\n");
128 system_arg(PING6
, PINGCOUNT
, hTunnel
->sIPv6_Local
);
129 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
131 printf("###### [%u/%u] Ping the IPv6 Remote/PoP Inner Tunnel Endpoint (%s)\n",
132 t
++, tottests
, hTunnel
->sIPv6_POP
);
133 printf("### This confirms the reachability of the other side of the tunnel\n");
134 printf("### If it doesn't reply then check your interface and routing tables\n");
135 printf("### Don't forget to check your firewall of course\n");
136 printf("### If the previous test was succesful then this could be both\n");
137 printf("### a firewalling and a routing/interface problem\n");
139 system_arg(PING6
, PINGCOUNT
, hTunnel
->sIPv6_POP
);
140 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
142 printf("###### [%u/%u] Traceroute6 to the central SixXS machine (noc.sixxs.net)\n",
144 printf("### This confirms that you can reach the central machine of SixXS\n");
145 printf("### If that one is reachable you should be able to reach most IPv6 destinations\n");
146 printf("### Also check http://www.sixxs.net/ipv6calc/ which should show an IPv6 connection\n");
147 printf("### If your browser supports IPv6 and uses it of course.\n");
149 system_arg(TRACEROUTE6
, "noc.sixxs.net");
150 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
152 printf("###### [%u/%u] Traceroute6 to (www.kame.net)\n",
154 printf("### This confirms that you can reach a Japanese IPv6 destination\n");
155 printf("### If that one is reachable you should be able to reach most IPv6 destinations\n");
156 printf("### You should also check http://www.kame.net which should display\n");
157 printf("### a animated kame (turtle), of course only when your browser supports and uses IPv6\n");
159 system_arg(TRACEROUTE6
, "www.kame.net");
160 if (!test_ask(automatic
) || !g_aiccu
->running
) return;
162 printf("###### ACCU Quick Connectivity Test (done)\n\n");
164 printf("### Either the above all works and gives no problems\n");
165 printf("### or it shows you where what goes wrong\n");
166 printf("### Check the SixXS FAQ (http://www.sixxs.net/faq/\n");
167 printf("### for more information and possible solutions or hints\n");
168 printf("### Don't forget to check the Forums (http://www.sixxs.net/forum/)\n");
169 printf("### for a helping hand.\n");
170 printf("### Passing the output of 'aiccu autotest >aiccu.log' is a good idea.\n");
174 /* Wait for a keypress */
175 printf("\n\n*** press a key to continue ***\n");