[ovs-dev] [PATCH v2] netdev-vport: Use the dst_port in tunnel netdev name

Ben Pfaff blp at ovn.org
Fri Feb 22 22:31:05 UTC 2019


On Fri, Feb 22, 2019 at 10:10:16AM +0800, Chris Mi wrote:
> If tunnel device dst_port is not the default one, "ovs-dpctl dump-flows"
> will fail. The error message for vxlan is:
> 
> netdev_linux|INFO|ioctl(SIOCGIFINDEX) on vxlan_sys_4789 device failed: No such device
> 
> That's because when calling netdev_vport_construct() for netdev
> vxlan_sys_xxxx, the default dst_port is used. Actually, the dst_port
> value is in the netdev name. Use it to avoid the error.
> 
> Signed-off-by: Chris Mi <chrism at mellanox.com>
> Reviewed-by: Roi Dayan <roid at mellanox.com>
> ---
> 
> v1
> ==
> 
> Any comment about this patch? We are not sure if it is correct
> to verify the port from the name. If it is correct, is it applicable
> for other tunnels? Thanks!
> 
> v2
> ==
> 
> Apply the same fix to other tunnel types according to Flavio Leitner's
> comment.

Thanks for the patch!

It looks to me that if 'name' and 'dpif_port' are exactly the same, then
this code will read past the null terminator in 'dpif_port':
+    if (!strncmp(name, dpif_port, strlen(dpif_port))) {
+        p = name + strlen(dpif_port) + 1;
+        port = atoi(p);
+    }

Thanks,

Ben.


More information about the dev mailing list