From patchwork Thu Nov 2 19:05:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 833510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ySZmk30rSz9sMN for ; Fri, 3 Nov 2017 06:25:25 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DAA7BE31; Thu, 2 Nov 2017 19:05:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9D45EE28 for ; Thu, 2 Nov 2017 19:05:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 28178463 for ; Thu, 2 Nov 2017 19:05:43 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id f8so662929qta.5 for ; Thu, 02 Nov 2017 12:05:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FsbhtrG/B4cCxNrR3gs5qP6P297TXWhyCShGQM0jkz8=; b=hlA0pdFJbxjUluSVSRJK3fZvhp/F9TyOd5tMUcF0ZNfJwthf4cJYm0nZfV60Y8CIKM YUvrIyCRtqvNzFibr1jIgTFXIgLt0UkGp+DqlyiUm/6y46l2EnaE64TEX6bE1BQ9HN/5 2nwdf/yeo+o+PSxoNn0Ml3ctBi4DTiqnDcXzIgbDEng9ih6+iSIJD+MbgC5u7vK5/RKi OX3mMCcs4vuNIFDw64cN8Wbn774e6ECoBhwIUtX9kB5ItpcHXLNJjjn20/jIMOSV0xMy n//2DPLgQkqjScKmWavg4RHXVsL+pmMhbPa3znpHPeKEWmHaCWCk2mwwKV6/cH1uc19F +NTg== X-Gm-Message-State: AMCzsaXZqsYY7ynIs8ftl2lhYYHSSio24mfh/lC8j8nGN6YAjppGytJg wSK7arN0nX6He4cQ0pWwIKCSg7tnjuo= X-Google-Smtp-Source: ABhQp+Qtaq9bqA3l/S1BcI0EQ+ohqIDCod/7hrbjsDbmOd1RVp920gChSY6oHY426b6+R7V9Hdj2GA== X-Received: by 10.237.47.195 with SMTP id m61mr6372571qtd.143.1509649542190; Thu, 02 Nov 2017 12:05:42 -0700 (PDT) Received: from localhost ([177.40.123.73]) by smtp.gmail.com with ESMTPSA id g23sm2673119qta.35.2017.11.02.12.05.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2017 12:05:41 -0700 (PDT) From: Flavio Leitner To: dev@openvswitch.org Date: Thu, 2 Nov 2017 17:05:01 -0200 Message-Id: <20171102190509.2688-1-fbl@redhat.com> X-Mailer: git-send-email 2.13.6 X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner , Jiri Benc Subject: [ovs-dev] [PATCH 0/8] Add minimum network namespace support. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Today Open vSwitch doesn't know about network namespaces (netns), but users are moving internal ports to other namespaces. Although packets are still flowing, the daemon fails to find out basic port information, like if it is UP or DOWN, for instance. This patchset rely on a new kernel vport API being proposed to netdev to find out the new network namespace ID of a bridge's port. This information along with the port's name recorded in the database is used to match the corresponding netlink messages. This patchset also leverages another kernel API that allows the daemon to listen to all netlink messages from all netns which has an ID assigned into it. This and the previous change allows the userspace to track ports in other network namespaces. If any of the APIs aren't available, it falls back to the older APIs to not break backwards compatibility. Flavio Leitner (8): netlink: provide network namespace id from a msg. netdev-linux: initialize netns as invalid. vport: retrieve the netnsid if available. netdev: update device info only if netns matches. netdev-linux: use netlink to update netdev. netlink linux: enable listening to all nsids nlmon: added netns support. netdev-linux: fail ops not supporting remote netns. configure.ac | 3 +- datapath/linux/compat/include/linux/openvswitch.h | 2 + lib/automake.mk | 1 + lib/daemon-unix.c | 3 +- lib/daemon.man | 6 +- lib/daemon.xml | 8 +- lib/dpif-netlink.c | 12 +- lib/dpif-netlink.h | 2 + lib/netdev-linux.c | 314 ++++++++++++++++++++-- lib/netlink-notifier.c | 2 +- lib/netlink-protocol.h | 6 + lib/netlink-socket.c | 64 ++++- lib/netlink-socket.h | 6 +- lib/netns.h | 119 ++++++++ tests/ofproto-macros.at | 1 + tests/ovn-controller-vtep.at | 1 + utilities/nlmon.c | 9 +- 17 files changed, 515 insertions(+), 44 deletions(-) create mode 100644 lib/netns.h