On Wed, Oct 05, 2016 at 04:20:43AM -0700, nickcooper-zhangtonghao wrote:
> The command "ovn-nbctl lrp-add" should not set the MAC address
> which length is invalid to logical router port. This patch
> updates the eth_addr_from_string() to check trailing characters.
> We should use the ovs_scan() to check the "addresses" owned by
> the logical port, instead of eth_addr_from_string(). This patch
> also updates the ovn-nbctl tests.
> 
> Signed-off-by: nickcooper-zhangtonghao 
> <nickcooper-zhangtong...@opencloud.tech>

Thanks, I applied this to master.  I folded in the following minor
incremental just because ovs_scan_len() is only really meant for
situations where the 'n' offset is being incremented over several calls.

--8<--------------------------cut here-------------------------->8--

diff --git a/lib/packets.c b/lib/packets.c
index f661c34..990c407 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -147,14 +147,13 @@ bool
 eth_addr_from_string(const char *s, struct eth_addr *ea)
 {
     int n = 0;
-    if (ovs_scan_len(s, &n, ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(*ea))) {
-        if (!s[n]) {
-            return true;
-        }
+    if (ovs_scan(s, ETH_ADDR_SCAN_FMT"%n", ETH_ADDR_SCAN_ARGS(*ea), &n)
+        && !s[n]) {
+        return true;
+    } else {
+        *ea = eth_addr_zero;
+        return false;
     }
-
-    *ea = eth_addr_zero;
-    return false;
 }
 
 /* Fills 'b' with a Reverse ARP packet with Ethernet source address 'eth_src'.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to