]>
git.ipfire.org Git - people/ms/network.git/blob - src/hooks/ports/macvlan
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
22 # XXX This hook is rather unusable because the parent device cannot be used
23 # anymore in a bridge.
26 .
/usr
/lib
/network
/header-port
28 HOOK_SETTINGS
="HOOK ADDRESS PARENT"
30 function hook_check
() {
35 function hook_create
() {
36 while [ $# -gt 0 ]; do
39 PARENT
=$
(cli_get_val
${1})
42 ADDRESS
=$
(cli_get_val
${1})
45 warning
"Unknown argument '${1}'"
51 local port
=$
(port_find_free
"${PARENT}${MACVLAN_PORT_INTERFIX}N")
54 if config_write $
(port_file
${port}) ${HOOK_SETTINGS}; then
55 log INFO
"New macvlan port '${port}' has been created."
61 function hook_edit
() {
66 config_read $
(port_file
${port})
68 while [ $# -gt 0 ]; do
71 ADDRESS
=$
(cli_get_val
${1})
74 warning
"Unknown argument '${1}'"
80 config_write $
(port_file
${port}) ${HOOK_SETTINGS}
89 config_read $
(port_file
${port})
91 # Create device if not already exists.
92 if ! device_exists
${port}; then
93 macvlan_create
"${port}" "${PARENT}" "${ADDRESS}"
99 function hook_down
() {
104 config_read $
(port_file
${port})
106 if ! device_exists
${port}; then
110 macvlan_remove
${port}