[Bridge] [PATCH v3 net-next 1/3] bridge: Add a default_pvid sysfs attribute
Toshiaki Makita
makita.toshiaki at lab.ntt.co.jp
Fri Oct 3 01:08:10 UTC 2014
On 2014/10/03 8:54, Vladislav Yasevich wrote:
> This patch allows the user to set and retrieve default_pvid
> value. A new value can only be stored when vlan filtering
> is disabled.
>
> Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com>
> ---
...
> +int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val)
> +{
> + u16 pvid = val;
> + int err = 0;
> +
> + if (!val || val >= VLAN_VID_MASK)
> + return -EINVAL;
> +
> + if (!rtnl_trylock())
> + return restart_syscall();
> +
> + if (pvid == br->default_pvid)
> + goto unlock;
> +
> + /* Only allow default pvid change when filtering is disabled */
> + if (br->vlan_enabled) {
> + pr_info_once("Please disable vlan filtering to change default_pvid\n");
> + err = -EPERM;
> + goto unlock;
> + }
> +
> + br->default_pvid = vid;
typo: s/vid/pvid/
Thanks,
Toshiaki Makita
More information about the Bridge
mailing list