Imported Upstream version 20070115
[aiccu.git] / common / aiccu_aix.c
blobe29e9effaf64aba07f5781c75bb16879d1869499
1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu_aix.c - AIX
8 ipv6_interface has to be eg cti0
9 ***********************************************************
10 $Author: jeroen $
11 $Id: aiccu_aix.c,v 1.3 2006-07-23 14:13:57 jeroen Exp $
12 $Date: 2006-07-23 14:13:57 $
13 **********************************************************/
15 #include "aiccu.h"
17 bool aiccu_os_install()
19 /* Define the CTI (Configured Tunnel Interface) by executing the deftunnel configuration method */
20 return aiccu_exec("/usr/lib/methods/deftunnel -c if -s CTI -t cti");
23 bool aiccu_os_setup(struct TIC_Tunnel *hTunnel)
25 if (hTunnel->uses_tundev == 0)
27 /* Build a normal SIT tunnel */
28 aiccu_exec(
29 "/usr/sbin/ifconfig %s inet6 ::%s/128 ::%s",
30 g_aiccu->ipv6_interface,
31 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local,
32 hTunnel->sIPv4_POP);
34 /* Remove the local endpoint, the remote stays though :) */
35 aiccu_exec(
36 "/usr/sbin/ifconfig %s inet6 ::%s delete",
37 g_aiccu->ipv6_interface,
38 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local);
40 /* Add the addresses */
41 aiccu_exec(
42 "ifconfig %s inet6 %s %s",
43 g_aiccu->ipv6_interface,
44 hTunnel->sIPv6_Local,
45 hTunnel->sIPv6_POP);
47 else
49 dolog(LOG_DEBUG, "There is no AIX support for tun-devices yet");
50 exit(-1);
53 if (g_aiccu->defaultroute)
55 aiccu_exec(
56 "route add -inet6 %s %s",
57 "default",
58 hTunnel->sIPv6_POP);
61 return true;
64 void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel)
66 if (hTunnel->uses_tundev == 0)
68 /* Build a normal SIT tunnel */
69 aiccu_exec(
70 "/usr/sbin/ifconfig %s inet6 ::%s/128 ::%s",
71 g_aiccu->ipv6_interface,
72 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local,
73 hTunnel->sIPv4_POP);
75 /* Remove the local endpoint, the remote stays */
76 aiccu_exec(
77 "/usr/sbin/ifconfig %s inet6 ::%s delete",
78 g_aiccu->ipv6_interface,
79 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local);
83 void aiccu_os_delete(struct TIC_Tunnel *hTunnel)
85 hTunnel = hTunnel;
86 aiccu_exec(
87 "ifconfig %s down",
88 g_aiccu->ipv6_interface);