diff options
author | Jesse Gross <jesse@nicira.com> | 2014-07-01 17:41:51 -0700 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2014-07-02 17:28:05 -0700 |
commit | a473df5b9ed172884e6d0f7a5bcedefa61731d3b (patch) | |
tree | 45989b975da35e91dccacee1561c0addc3419234 /datapath/flow_netlink.c | |
parent | 8f20fd98db14404ea7c396ca91c5b29f3b20769f (diff) |
datapath: Additional logging for -EINVAL on flow setups.
There are many possible ways that a flow can be invalid so we've
added logging for most of them. This adds logs for the remaining
possible cases so there isn't any ambiguity while debugging.
CC: Federico Iezzi <fiezzi@enter.it>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Diffstat (limited to 'datapath/flow_netlink.c')
-rw-r--r-- | datapath/flow_netlink.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 925e9fbd7..6ae69e9e6 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -462,6 +462,7 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr, nla_data(a), nla_len(a), is_mask); break; default: + OVS_NLERR("Unknown IPv4 tunnel attribute (%d).\n", type); return -EINVAL; } } @@ -558,10 +559,13 @@ static int metadata_from_nlattrs(struct sw_flow_match *match, u64 *attrs, if (*attrs & (1ULL << OVS_KEY_ATTR_IN_PORT)) { u32 in_port = nla_get_u32(a[OVS_KEY_ATTR_IN_PORT]); - if (is_mask) + if (is_mask) { in_port = 0xffffffff; /* Always exact match in_port. */ - else if (in_port >= DP_MAX_PORTS) + } else if (in_port >= DP_MAX_PORTS) { + OVS_NLERR("Input port (%d) exceeds maximum allowable (%d).\n", + in_port, DP_MAX_PORTS); return -EINVAL; + } SW_FLOW_KEY_PUT(match, phy.in_port, in_port, is_mask); *attrs &= ~(1ULL << OVS_KEY_ATTR_IN_PORT); @@ -801,8 +805,11 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, attrs &= ~(1ULL << OVS_KEY_ATTR_ND); } - if (attrs != 0) + if (attrs != 0) { + OVS_NLERR("Unknown key attributes (%llx).\n", + (unsigned long long)attrs); return -EINVAL; + } return 0; } @@ -1203,8 +1210,11 @@ struct sw_flow_actions *ovs_nla_alloc_flow_actions(int size) { struct sw_flow_actions *sfa; - if (size > MAX_ACTIONS_BUFSIZE) + if (size > MAX_ACTIONS_BUFSIZE) { + OVS_NLERR("Flow action size (%u bytes) exceeds maximum " + "(%u bytes)\n", size, MAX_ACTIONS_BUFSIZE); return ERR_PTR(-EINVAL); + } sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL); if (!sfa) |