From 778ea0a463e08b2f47d69288367ac7960712fb0c Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Tue, 2 Apr 2013 16:34:28 -0700 Subject: [PATCH] datapath: Don't insert empty OVS_VPORT_ATTR_OPTIONS attribute The port specific options are currently unused resulting in an empty OVS_VPORT_ATTR_OPTIONS nested attribute being inserted into every OVS_VPORT_CMD_GET message. Don't insert OVS_VPORT_ATTR_OPTIONS if no options are present. Signed-off-by: Thomas Graf [jesse: Options are used by tunnels but the concept still applies.] Signed-off-by: Jesse Gross --- datapath/vport.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index d458a9517..e9e144453 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -378,17 +378,19 @@ void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb) { struct nlattr *nla; + int err; + + if (!vport->ops->get_options) + return 0; nla = nla_nest_start(skb, OVS_VPORT_ATTR_OPTIONS); if (!nla) return -EMSGSIZE; - if (vport->ops->get_options) { - int err = vport->ops->get_options(vport, skb); - if (err) { - nla_nest_cancel(skb, nla); - return err; - } + err = vport->ops->get_options(vport, skb); + if (err) { + nla_nest_cancel(skb, nla); + return err; } nla_nest_end(skb, nla); -- 2.43.0