]>
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_freebsd4.c - FreeBSD 3.x/4.x | |
7 | *********************************************************** | |
8 | $Author: jeroen $ | |
9 | $Id: aiccu_freebsd4.c,v 1.11 2007-01-07 17:05:23 jeroen Exp $ | |
10 | $Date: 2007-01-07 17:05:23 $ | |
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 | /* Create the tunnel device */ | |
25 | aiccu_exec( | |
26 | "/sbin/ifconfig %s create", | |
27 | g_aiccu->ipv6_interface); | |
28 | ||
29 | /* Configure the endpoint */ | |
30 | aiccu_exec( | |
31 | "/sbin/ifconfig %s tunnel %s %s", | |
32 | g_aiccu->ipv6_interface, | |
33 | strcmp(hTunnel->sIPv4_Local, "heartbeat") == 0 ? "0.0.0.0" : hTunnel->sIPv4_Local, | |
34 | hTunnel->sIPv4_POP); | |
35 | } | |
36 | ||
37 | /* Mark the interface up */ | |
38 | aiccu_exec( | |
39 | "ifconfig %s up", | |
40 | g_aiccu->ipv6_interface); | |
41 | ||
42 | /* Configure the MTU */ | |
43 | aiccu_exec( | |
44 | "ifconfig %s mtu %u", | |
45 | g_aiccu->ipv6_interface, | |
46 | hTunnel->nMTU); | |
47 | ||
48 | if (hTunnel->uses_tundev == 1) | |
49 | { | |
50 | /* Give it a link local address */ | |
51 | aiccu_exec( | |
52 | "ifconfig %s inet6 %s prefixlen 64 alias", | |
53 | g_aiccu->ipv6_interface, | |
54 | hTunnel->sIPv6_LinkLocal); | |
55 | } | |
56 | ||
57 | /* Local side of the tunnel */ | |
58 | aiccu_exec( | |
59 | "ifconfig %s inet6 %s prefixlen 128 alias", | |
60 | g_aiccu->ipv6_interface, | |
61 | hTunnel->sIPv6_Local); | |
62 | ||
63 | /* Route to the remote side of the tunnel */ | |
64 | aiccu_exec( | |
65 | "route add -inet6 %s -prefixlen 128 %s", | |
66 | hTunnel->sIPv6_POP, | |
67 | hTunnel->sIPv6_Local); | |
68 | ||
69 | if (g_aiccu->defaultroute) | |
70 | { | |
71 | /* Add a default route */ | |
72 | aiccu_exec( | |
73 | "route add -inet6 %s %s", | |
74 | "default", | |
75 | hTunnel->sIPv6_POP); | |
76 | } | |
77 | ||
78 | return true; | |
79 | } | |
80 | ||
81 | void aiccu_os_reconfig(struct TIC_Tunnel *hTunnel) | |
82 | { | |
83 | if (hTunnel->uses_tundev == 0) | |
84 | { | |
85 | /* Change the endpoints of the tunnel */ | |
86 | aiccu_exec( | |
87 | "/sbin/ifconfig %s tunnel %s %s", | |
88 | g_aiccu->ipv6_interface, | |
89 | hTunnel->sIPv4_Local, | |
90 | hTunnel->sIPv4_POP); | |
91 | } | |
92 | } | |
93 | ||
94 | void aiccu_os_delete(struct TIC_Tunnel *hTunnel) | |
95 | { | |
96 | hTunnel = hTunnel; | |
97 | ||
98 | /* Mark the interface down */ | |
99 | aiccu_exec( | |
100 | "ifconfig %s down", | |
101 | g_aiccu->ipv6_interface); | |
102 | ||
103 | if (hTunnel->uses_tundev == 0) | |
104 | { | |
105 | /* Destroy the tunnel */ | |
106 | aiccu_exec( | |
107 | "ifconfig %s destroy", | |
108 | g_aiccu->ipv6_interface); | |
109 | } | |
110 | } | |
111 |