1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 11:01:50 +00:00

Remove luci-app-macvlan

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-06-26 14:52:43 +02:00
parent 9a71717f26
commit 24c7bc9c28
8 changed files with 0 additions and 284 deletions

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpeenMPTCProuter
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for macvlan
LUC_PKGARCH:=all
LUCI_DEPENDS:=+kmod-macvlan +busybox +@BUSYBOX_CUSTOM +@BUSYBOX_CONFIG_VCONFIG
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -1,35 +0,0 @@
'use strict';
'require rpc';
'require form';
'require tools.widgets as widgets';
return L.view.extend({
callHostHints: rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
}),
load: function() {
return this.callHostHints();
},
render: function(hosts) {
var m, s, o;
m = new form.Map('macvlan', _('Macvlan'));
s = m.section(form.GridSection, 'macvlan', _('Interfaces'));
s.addremove = true;
s.anonymous = true;
o = s.option(form.Value, 'name', _('Name'));
o.datatype = 'uciname';
o.rmempty = false;
o = s.option(widgets.DeviceSelect, 'ifname', _('Interface'));
o.rmempty = false;
return m.render();
}
});

View file

@ -1,23 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: luci-app-macvlan/root/usr/share/rpcd/acl.d/luci-app-macvlan.json:3
msgid "Grant UCI access for luci-app-macvlan"
msgstr ""
#: luci-app-macvlan/htdocs/luci-static/resources/view/network/macvlan.js:30
msgid "Interface"
msgstr ""
#: luci-app-macvlan/htdocs/luci-static/resources/view/network/macvlan.js:22
msgid "Interfaces"
msgstr ""
#: luci-app-macvlan/htdocs/luci-static/resources/view/network/macvlan.js:20
#: luci-app-macvlan/root/usr/share/luci/menu.d/luci-app-macvlan.json:3
msgid "Macvlan"
msgstr ""
#: luci-app-macvlan/htdocs/luci-static/resources/view/network/macvlan.js:26
msgid "Name"
msgstr ""

View file

@ -1,175 +0,0 @@
#!/bin/sh /etc/rc.common
START=4
USE_PROCD=1
_setup_macaddr() {
uci -q get "network.$1_dev.macaddr" >/dev/null && return
uci -q set "network.$1_dev.macaddr=$2"
}
_save_macaddr() {
local _ifname
local _macaddr
uci -q get "network.$1_dev.ifname" >/dev/null && {
_ifname=$(uci -q get "network.$1.ifname")
if [ -n "$(uci -q get network.$1.macaddr)" ] && [ "$(uci -q get network.$1.macaddr)" != "$(uci -q get network.$1_dev.macaddr)" ]; then
uci -q set network.$1_dev.macaddr="$(uci -q get network.$1.macaddr)"
else
_macaddr=$(ip link show dev $_ifname 2>/dev/null | grep link | awk '{print $2}')
[ -n "$_macaddr" ] && {
uci -q set network.$1_dev.macaddr=$_macaddr
uci -q set network.$1.macaddr=$_macaddr
}
fi
}
[ -z "$(uci -q get network.$1.macaddr)" ] && {
_ifname=$(uci -q get "network.$1.ifname")
[ -n "$_ifname" ] && {
_macaddr=$(ip link show dev $_ifname 2>/dev/null | grep link | awk '{print $2}')
[ -n "$_macaddr" ] && {
uci -q set network.$1.macaddr=$_macaddr
}
}
}
}
_create_interface() {
local _masterifname
config_get _ifname "$1" name
# Convert from old config without name defined
[ -z "$_ifname" ] && {
uci batch <<-EOF
set macvlan.$1.name=$1
commit macvlan
EOF
_ifname=$1
}
config_get _masterifname "$1" ifname
[ "$1" != "$_ifname" ] && {
uci batch <<-EOF
delete macvlan.$1
set macvlan.$_ifname=macvlan
set macvlan.$_ifname.name=$_ifname
set macvlan.$_ifname.ifname=$_masterifname
commit macvlan
EOF
}
[ "$(uci -q get network.$_ifname.masterintf)" != "$_masterifname" ] && {
logger -t "MACVLAN" "Create interface $_ifname based on $_masterifname"
uci batch <<-EOF
set network.$_ifname=interface
set network.$_ifname.type=macvlan
set network.$_ifname.proto=static
set network.$_ifname.masterintf=$_masterifname
commit network
EOF
}
}
# Configuration by interface
_setup_interface() {
local _ifname
config_get _ifname "$1" ifname
#[ -z "$_ifname" ] && config_get _ifname "$1" ifname
# do not create macvlan for vlan
#case "$_ifname" in
# eth*.*) return ;;
#esac
local _type
config_get _type "$1" type
[ "$_type" = "macvlan" ] && [ "$(uci -q get macvlan.$1)" = "" ] && {
logger -t "MACVLAN" "Delete $1"
uci -q batch <<-EOF
delete network.$1
delete network.$1_dev
commit network
EOF
return
}
[ "$(echo $1 | grep _dev)" != "" ] && {
local _intfdev=$(sed 's/_dev//' $1)
uci -q get "network.$_intfdev.ifname" >/dev/null || {
logger -t "macvlan" "Remove network.$1"
uci -q batch <<-EOF
delete network.$1
commit network
delete macvlan.$1
commit macvlan
EOF
}
return
}
#_type="$(uci -q get network.$1.type)
if [ "$(uci -q get macvlan.$1)" != "" ]; then
_type="macvlan"
fi
uci -q get "network.$1_dev.ifname" >/dev/null && {
uci -q set network.$1_dev.mtu=$(uci -q get network.$1.mtu)
[ -n "$(uci -q get macvlan.$1.ifname)" ] && uci -q set network.$1_dev.ifname=$(uci -q get macvlan.$1.ifname)
[ -z "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1.masterintf=$(uci -q get network.$1_dev.ifname)
[ -n "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1_dev.ifname=$(uci -q get network.$1.masterintf)
[ -z "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr)
[ "$_type" = "macvlan" ] || {
logger -t "macvlan" "Remove network.$1_dev"
uci -q batch <<-EOF
delete network.$1_dev
set network.$1.ifname=$(uci -q get network.$1.masterintf)
delete network.$1.masterintf
EOF
}
[ "$_type" = "macvlan" ] && {
local interface
config_get _interface "$1" interface
[ -n "$_interface" ] && {
logger -t "macvlan" "Remove network.$1_dev"
uci -q batch <<-EOF
delete network.$1
set network.$1_dev.ifname=$_interface
EOF
}
}
uci -q commit network
return 0
}
[ "$_type" = "macvlan" ] || return 0
[ -z "$_ifname" ] && _ifname=$(uci -q get macvlan.$1.ifname)
uci -q batch <<-EOF
set network.$1_dev=device
set network.$1_dev.name=$1
set network.$1_dev.type=macvlan
set network.$1_dev.ifname=$_ifname
set network.$1.ifname=$1
set network.$1.masterintf=$_ifname
set network.$1.type=macvlan
set network.$1.defaultroute=0
EOF
_macaddr=$(uci -q get "network.$1.macaddr")
_setup_macaddr "$1" "${_macaddr:-auto$(date +%s)}"
uci -q set network.$1_dev.mtu=$(uci -q get network.$1.mtu)
uci -q commit network
}
start_service() {
. /lib/functions.sh
config_load macvlan
config_foreach _create_interface macvlan
config_load network
config_foreach _setup_interface interface
config_foreach _save_macaddr interface
uci -q commit network
}
reload_service() {
start
}
service_triggers() {
procd_add_reload_trigger network macvlan
}

View file

@ -1,11 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@macvlan[-1]
add ucitrack macvlan
set ucitrack.@macvlan[-1].init=macvlan
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View file

@ -1,13 +0,0 @@
{
"admin/network/macvlan": {
"title": "Macvlan",
"order": 60,
"action": {
"type": "view",
"path": "network/macvlan"
},
"depends": {
"acl": [ "luci-app-macvlan" ]
}
}
}

View file

@ -1,11 +0,0 @@
{
"luci-app-macvlan": {
"description": "Grant UCI access for luci-app-macvlan",
"read": {
"uci": [ "macvlan" ]
},
"write": {
"uci": [ "macvlan" ]
}
}
}