On Thu, Jun 07, 2018 at 04:33:50PM +0200, Eelco Chaudron wrote:
> On 07/06/18 16:10, Flavio Leitner wrote:
> >If the 'openvswitch' kernel module is not loaded, the API is not
> >available and the userspace will keep retrying. This approach is
> >not ideal for the netdev datapath type.
> >
> >This patch disables network netns support if the error code returned
> >indicates that the API is not available.
> >
> >Reported-by: Eelco Chaudron <[email protected]>
> >Signed-off-by: Flavio Leitner <[email protected]>
> >---
> > lib/netdev-linux.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> >diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> >index d2b79e569..10c1e4386 100644
> >--- a/lib/netdev-linux.c
> >+++ b/lib/netdev-linux.c
> >@@ -586,7 +586,11 @@ netdev_linux_netnsid_update__(struct netdev_linux
> >*netdev)
> > int error;
> > error = dpif_netlink_vport_get(netdev_get_name(&netdev->up), &reply,
> > &buf);
> >- if (error) {
> >+ if (error == ENOENT) {
> >+ /* Assume it is local if there is no API */
> >+ netnsid_set_local(&netdev->netnsid);
> >+ return error;
> >+ } else if (error) {
> > netnsid_unset(&netdev->netnsid);
> > return error;
> > }
>
> Acked-by: Eelco Chaudron <[email protected]>
> Tested-by: Eelco Chaudron <[email protected]>
Thanks, Flavio (and Eelco). I applied this to master. I hope you will
forgive me for fussing with it a bit stylistically and to improve the
comment. I committed it in the following form:
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index e2bbbb827434..1d2b7ea4cd00 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -587,7 +587,13 @@ netdev_linux_netnsid_update__(struct netdev_linux *netdev)
error = dpif_netlink_vport_get(netdev_get_name(&netdev->up), &reply, &buf);
if (error) {
- netnsid_unset(&netdev->netnsid);
+ if (error == ENOENT) {
+ /* Assume it is local if there is no API (e.g. if the openvswitch
+ * kernel module is not loaded). */
+ netnsid_set_local(&netdev->netnsid);
+ } else {
+ netnsid_unset(&netdev->netnsid);
+ }
return error;
}
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev