]> git.ipfire.org Git - people/stevee/aiccu.git/blob - common/aiccu_kame.c
spelling error
[people/stevee/aiccu.git] / common / aiccu_kame.c
1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu_kame.c - NetBSD + FreeBSD 5.x+
7 ***********************************************************
8 $Author: jeroen $
9 $Id: aiccu_kame.c,v 1.15 2007-01-11 15:11:27 jeroen Exp $
10 $Date: 2007-01-11 15:11:27 $
11 **********************************************************/
12
13 #include "aiccu.h"
14
15 bool aiccu_os_install(void)
16 {
17 return true;
18 }
19
20 bool aiccu_os_setup(struct TIC_Tunnel *hTunnel)
21 {
22 if (hTunnel->uses_tundev == 0)
23 {
24 aiccu_exec(
25 "/sbin/ifconfig %s create",
26 g_aiccu->ipv6_interface);
27
28 aiccu_exec(
29 "/sbin/ifconfig %s tunnel %s %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
35 aiccu_exec(
36 "ifconfig %s up",
37 g_aiccu->ipv6_interface);
38
39 aiccu_exec(
40 "ifconfig %s mtu %u",
41 g_aiccu->ipv6_interface,
42 hTunnel->nMTU);
43
44 if (hTunnel->uses_tundev == 1)
45 {
46 /* Configure a generated linklocal address */
47 aiccu_exec(
48 "ifconfig %s inet6 %s prefixlen 64 alias",
49 g_aiccu->ipv6_interface,
50 hTunnel->sIPv6_LinkLocal);
51 }
52
53 /* PtP link, so we can use the PtP syntax */
54 aiccu_exec(
55 "ifconfig %s inet6 %s %s prefixlen 128 alias",
56 g_aiccu->ipv6_interface,
57 hTunnel->sIPv6_Local,
58 hTunnel->sIPv6_POP);
59
60 if (g_aiccu->defaultroute)
61 {
62 aiccu_exec(
63 "route add -inet6 %s %s",
64 "default",
65 hTunnel->sIPv6_POP);
66 }
67
68 return true;
69 }
70
71 void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel)
72 {
73 if (hTunnel->uses_tundev == 0)
74 {
75 aiccu_exec(
76 "/sbin/ifconfig %s tunnel %s %s",
77 g_aiccu->ipv6_interface,
78 hTunnel->sIPv4_Local,
79 hTunnel->sIPv4_POP);
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 if (hTunnel->uses_tundev == 0)
91 {
92 aiccu_exec(
93 "ifconfig %s deletetunnel",
94 g_aiccu->ipv6_interface);
95 }
96 }
97