]> git.ipfire.org Git - people/stevee/network.git/blame - src/helpers/miredo-helper
Rename all "config" to "settings"
[people/stevee/network.git] / src / helpers / miredo-helper
CommitLineData
28f0b4ab
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2012 IPFire Network Development Team #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22LOG_FACILITY="miredo-helper"
23
24. /usr/lib/network/functions
25
e9df08ad
MT
26# Read network settings
27network_settings_read
28
28f0b4ab
MT
29action="${STATE}"
30assert isset action
31
32zone="${IFACE}"
33assert zone_exists ${zone}
34
35log DEBUG "Called for zone=${zone} action=${action}."
36
37case "${action}" in
38 up)
39 # Configure the requested MTU.
40 isset MTU && device_set_mtu ${zone} ${MTU}
41
42 # Bring up the device.
43 device_set_up ${zone}
44
45 # Apply the link-local address.
46 ip_address_add ${zone} "${LLADDRESS}/64"
47
48 # Apply the public IP address.
49 ip_address_add ${zone} "${ADDRESS}/32"
50
51 # Write all data to the routing database.
52 routing_db_set ${zone} ipv6 type "teredo"
53 routing_db_set ${zone} ipv6 local-ip-address "${ADDRESS}/32"
54 routing_db_set ${zone} ipv6 active 1
55
56 # Update the routing database.
57 routing_update ${zone} ipv6
58 routing_default_update
59 ;;
60
61 down)
62 # Remove the routing database and update the tables.
63 routing_db_remove ${zone} ipv6
64 routing_update ${zone} ipv6
65 routing_default_update
66
67 # Set down the device.
68 device_set_down ${zone}
69 ;;
70
71 destroy)
72 # Do nothing here.
73 ;;
74
75 *)
76 log ERROR "Unknown action passed: ${action}"
77 exit ${EXIT_ERROR}
78 ;;
79esac
80
81exit ${EXIT_OK}