]> git.ipfire.org Git - people/stevee/aiccu.git/blame - common/aiccu_darwin.c
Add setup script functionality to Linux client
[people/stevee/aiccu.git] / common / aiccu_darwin.c
CommitLineData
d98f6a46
SS
1/**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5***********************************************************
6 common/aiccu_darwin.c - Darwin
7***********************************************************
8 $Author: jeroen $
9 $Id: aiccu_darwin.c,v 1.11 2007-01-07 17:02:11 jeroen Exp $
10 $Date: 2007-01-07 17:02:11 $
11**********************************************************/
12
13#include "aiccu.h"
14
15bool aiccu_os_install(void)
16{
17 return true;
18}
19
20bool aiccu_os_setup(struct TIC_Tunnel *hTunnel)
21{
22 if (hTunnel->uses_tundev == 0)
23 {
24 aiccu_exec(
25 "/sbin/ifconfig %s tunnel %s %s",
26 g_aiccu->ipv6_interface,
27 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local,
28 hTunnel->sIPv4_POP);
29 }
30
31 /* Bring the interface up */
32 aiccu_exec(
33 "ifconfig %s up",
34 g_aiccu->ipv6_interface);
35
36 /* Configure the MTU */
37 aiccu_exec(
38 "ifconfig %s mtu %u",
39 g_aiccu->ipv6_interface,
40 hTunnel->nMTU);
41
42 /* PtP link, so we can use the PtP syntax */
43 aiccu_exec(
44 "ifconfig %s inet6 %s %s prefixlen 128 alias",
45 g_aiccu->ipv6_interface,
46 hTunnel->sIPv6_Local,
47 hTunnel->sIPv6_POP);
48
49 /* Configure a path to the other side */
50 if (g_aiccu->defaultroute)
51 {
52 aiccu_exec(
53 "route add -inet6 %s %s",
54 "default",
55 hTunnel->sIPv6_POP);
56 }
57
58 return true;
59}
60
61void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel)
62{
63 if (hTunnel->uses_tundev == 0)
64 {
65 aiccu_exec(
66 "/sbin/ifconfig %s tunnel %s %s",
67 g_aiccu->ipv6_interface,
68 hTunnel->sIPv4_Local,
69 hTunnel->sIPv4_POP);
70 }
71}
72
73void aiccu_os_delete(struct TIC_Tunnel *hTunnel)
74{
75 hTunnel = hTunnel;
76 aiccu_exec(
77 "ifconfig %s down",
78 g_aiccu->ipv6_interface);
79
80 if (hTunnel->uses_tundev == 0)
81 {
82 aiccu_exec(
83 "ifconfig %s deletetunnel",
84 g_aiccu->ipv6_interface);
85 }
86}
87