]>
Commit | Line | Data |
---|---|---|
d98f6a46 SS |
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 | |
7 | ||
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 | **********************************************************/ | |
14 | ||
15 | #include "aiccu.h" | |
16 | ||
17 | bool aiccu_os_install() | |
18 | { | |
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"); | |
21 | } | |
22 | ||
23 | bool aiccu_os_setup(struct TIC_Tunnel *hTunnel) | |
24 | { | |
25 | if (hTunnel->uses_tundev == 0) | |
26 | { | |
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); | |
33 | ||
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); | |
39 | ||
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); | |
46 | } | |
47 | else | |
48 | { | |
49 | dolog(LOG_DEBUG, "There is no AIX support for tun-devices yet"); | |
50 | exit(-1); | |
51 | } | |
52 | ||
53 | if (g_aiccu->defaultroute) | |
54 | { | |
55 | aiccu_exec( | |
56 | "route add -inet6 %s %s", | |
57 | "default", | |
58 | hTunnel->sIPv6_POP); | |
59 | } | |
60 | ||
61 | return true; | |
62 | } | |
63 | ||
64 | void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel) | |
65 | { | |
66 | if (hTunnel->uses_tundev == 0) | |
67 | { | |
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); | |
74 | ||
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); | |
80 | } | |
81 | } | |
82 | ||
83 | void aiccu_os_delete(struct TIC_Tunnel *hTunnel) | |
84 | { | |
85 | hTunnel = hTunnel; | |
86 | aiccu_exec( | |
87 | "ifconfig %s down", | |
88 | g_aiccu->ipv6_interface); | |
89 | } | |
90 |