Imported Upstream version 20070115
[aiccu.git] / common / aiccu_openbsd2.c
blob3f3c03c5d31ec3d397a3ff3d68c369278947fec1
1 /**********************************************************
2 SixXS - Automatic IPv6 Connectivity Configuration Utility
3 ***********************************************************
4 Copyright 2003-2005 SixXS - http://www.sixxs.net
5 ***********************************************************
6 common/aiccu_openbsd2.c - OpenBSD 2.7-2.9
7 ***********************************************************
8 $Author: jeroen $
9 $Id: aiccu_openbsd2.c,v 1.7 2007-01-07 16:37:50 jeroen Exp $
10 $Date: 2007-01-07 16:37:50 $
12 Original version provided by Wouter Van Hemel
13 **********************************************************/
15 #include "aiccu.h"
17 bool aiccu_os_install(void)
19 return true;
22 bool aiccu_os_setup(struct TIC_Tunnel *hTunnel)
24 if (hTunnel->uses_tundev == 0)
26 aiccu_exec(
27 "/sbin/ifconfig %s giftunnel %s %s",
28 g_aiccu->ipv6_interface,
29 strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local,
30 hTunnel->sIPv4_POP);
33 aiccu_exec(
34 "ifconfig %s up",
35 g_aiccu->ipv6_interface);
37 aiccu_exec(
38 "ifconfig %s mtu %u",
39 g_aiccu->ipv6_interface,
40 hTunnel->nMTU);
42 if (hTunnel->uses_tundev == 1)
44 aiccu_exec(
45 "ifconfig %s inet6 %s prefixlen 64 alias",
46 g_aiccu->ipv6_interface,
47 hTunnel->sIPv6_LinkLocal);
50 aiccu_exec(
51 "ifconfig %s inet6 %s %s prefixlen 128 alias",
52 g_aiccu->ipv6_interface,
53 hTunnel->sIPv6_Local,
54 hTunnel->sIPv6_POP);
56 if (g_aiccu->defaultroute)
58 aiccu_exec(
59 "route add -inet6 %s %s",
60 "default",
61 hTunnel->sIPv6_POP);
64 return true;
67 void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel)
69 aiccu_exec(
70 "/sbin/ifconfig %s giftunnel %s %s",
71 g_aiccu->ipv6_interface,
72 hTunnel->sIPv4_Local,
73 hTunnel->sIPv4_POP);
76 void aiccu_os_delete(struct TIC_Tunnel *hTunnel)
78 hTunnel = hTunnel;
79 aiccu_exec(
80 "ifconfig %s down",
81 g_aiccu->ipv6_interface);
83 aiccu_exec(
84 "ifconfig %s inet6 %s %s prefixlen 128 -alias",
85 g_aiccu->ipv6_interface,
86 hTunnel->sIPv6_Local,
87 hTunnel->sIPv6_POP);