]> git.ipfire.org Git - people/stevee/aiccu.git/blob - common/aiccu_openbsd.c
Add setup script functionality to Linux client
[people/stevee/aiccu.git] / common / aiccu_openbsd.c
1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu_openbsd.c - OpenBSD
7 ***********************************************************
8 $Author: jeroen $
9 $Id: aiccu_openbsd.c,v 1.11 2007-01-07 16:37:50 jeroen Exp $
10 $Date: 2007-01-07 16:37:50 $
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 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 aiccu_exec(
32 "ifconfig %s up",
33 g_aiccu->ipv6_interface);
34
35 aiccu_exec(
36 "ifconfig %s mtu %u",
37 g_aiccu->ipv6_interface,
38 hTunnel->nMTU);
39
40 if (hTunnel->uses_tundev == 1)
41 {
42 aiccu_exec(
43 "ifconfig %s inet6 %s prefixlen 64 alias",
44 g_aiccu->ipv6_interface,
45 hTunnel->sIPv6_LinkLocal);
46 }
47
48 aiccu_exec(
49 "ifconfig %s inet6 %s %s prefixlen 128 alias",
50 g_aiccu->ipv6_interface,
51 hTunnel->sIPv6_Local,
52 hTunnel->sIPv6_POP);
53
54 if (g_aiccu->defaultroute)
55 {
56 aiccu_exec(
57 "route add -inet6 %s %s",
58 "default",
59 hTunnel->sIPv6_POP);
60 }
61
62 return true;
63 }
64
65 void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel)
66 {
67 aiccu_exec(
68 "/sbin/ifconfig %s tunnel %s %s",
69 g_aiccu->ipv6_interface,
70 hTunnel->sIPv4_Local,
71 hTunnel->sIPv4_POP);
72 }
73
74 void aiccu_os_delete(struct TIC_Tunnel *hTunnel)
75 {
76 hTunnel = hTunnel;
77 aiccu_exec(
78 "ifconfig %s down",
79 g_aiccu->ipv6_interface);
80
81 if (hTunnel->uses_tundev == 0)
82 {
83 aiccu_exec(
84 "ifconfig %s deletetunnel",
85 g_aiccu->ipv6_interface);
86 }
87 }
88