From: Ben Pfaff Date: Mon, 17 Oct 2011 18:03:22 +0000 (-0700) Subject: datapath: Reject attempts to change vport type with OVS_VPORT_CMD_SET. X-Git-Tag: v1.3.0~76 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=4879d4c7c9c7632dc7d684b9440ff84b823e588a;p=sliver-openvswitch.git datapath: Reject attempts to change vport type with OVS_VPORT_CMD_SET. Until now this has just silently failed, but it seems to me like we should actively reject it. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- diff --git a/datapath/datapath.c b/datapath/datapath.c index b3e24427c..cd29482c5 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1751,7 +1751,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) goto exit_unlock; err = 0; - if (a[OVS_VPORT_ATTR_OPTIONS]) + if (a[OVS_VPORT_ATTR_TYPE] && nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport_get_type(vport)) + err = -EINVAL; + if (!err && a[OVS_VPORT_ATTR_OPTIONS]) err = vport_set_options(vport, a[OVS_VPORT_ATTR_OPTIONS]); if (!err) err = change_vport(vport, a);