On 08/09/2010 10:01 PM, Felix Fietkau wrote:
> On 2010-08-09 9:36 PM, Johannes Schlatow wrote:
>> This patch adds support for macvlan interfaces to uci.
>> * ifname pattern is ethXvY, where ethX is the physical interface, Y is
>> arbitrary
>> * you can specify a mac address
>> * dependencies: kmod-macvlan, ip
>>
>> e.g.:
>>
>> $ uci show network.dmz
>> network.dmz=interface
>> network.dmz.proto=dhcp
>> network.dmz.ifname=eth0v2
>> network.dmz.macaddr=01:23:45:67:89:ab
> I don't like the arbitrary naming pattern and the config format
> ambiguities that it introduces. Could you please change the config
> format to make the distinction between macvlan and other stuff more
> clear, and also allow the user to specify macvlan interface name and
> base interface name separately.
>
> - Felix
Okay. I suppose you would expect something like this:
$ uci show network.dmz
network.dmz.proto=dhcp
network.dmz.ifname=myvlan0
network.dmz.type=macvlan
network.dmz.basedev=eth0
network.dmz.macaddr=01:23:45:67:89:ab
---
Index: package/base-files/files/lib/network/config.sh
===================================================================
--- package/base-files/files/lib/network/config.sh (revision 22530)
+++ package/base-files/files/lib/network/config.sh (working copy)
@@ -154,11 +154,30 @@
# Setup VLAN interfaces
add_vlan "$iface" && return 1
- ifconfig "$iface" 2>/dev/null >/dev/null || return 0
- # Setup bridging
local iftype
config_get iftype "$config" type
+
+ [ "$iftype" = "macvlan" ] && {
+ local macaddr
+ local basedev
+
+ config_get macaddr "$config" macaddr
+ config_get basedev "$config" basedev
+
+ [ -z "$macaddr" ] || {
+ macaddr="address $macaddr "
+ }
+
+ [ -z "$basedev" ] || {
+ $DEBUG ip link add link ${basedev} name ${iface} ${macaddr}type macvlan
+ return 1
+ }
+ }
+
+ ifconfig "$iface" 2>/dev/null >/dev/null || return 0
+
+ # Setup bridging
case "$iftype" in
bridge)
local macaddr
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel