From patchwork Thu Nov 2 19:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 833518 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 3ySZy83RDSz9sNd for ; Fri, 3 Nov 2017 06:33:36 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8824AE90; Thu, 2 Nov 2017 19:06:07 +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 9E0BDE0D for ; Thu, 2 Nov 2017 19:06:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4F5AE484 for ; Thu, 2 Nov 2017 19:06:05 +0000 (UTC) Received: by mail-qk0-f193.google.com with SMTP id f199so643839qke.2 for ; Thu, 02 Nov 2017 12:06:05 -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:in-reply-to :references; bh=TQXit8qDhtRYsujwWE9pdFZW5PHF3bRLOOo60Illl0M=; b=XSN+gprDSY3H4m+ofHXHyTWE736vClC2n7iYZVTtRJ3054cgwIgBQwygvfkS/cklo2 lyFQNV/h3dEDha2GT0HwdI5wtbI4aNNZ2WJpvlu/4CvQyW8BfnOAlapihr9KGSc17HnQ GqryjnqQAqIT32s4G+ek3+i4ccvq/X59zlD0b8lYbPNj/TqUkJa5neFbpR4LV+H8odrB 3LajS/dxJnmMclufnDdrJyQZPBQqkiiHrjLZtzz5qLQIHVFVZbbvAi0gMgmEAlBy1RbH e39t25ieeHQ9XwpGAvoLrmHpdQt2wxWVGSSIv5XdXE1I7PM5y2TN1TGXa07M9wG6EmoD /IJg== X-Gm-Message-State: AMCzsaUTRNZM1+bDGBQ8cUdV+oasKzve7tHGhiUa8ad3dzZnhB2rxH0i b3JNXQmhcmJJ95FFUqrYLJXpaKaK6lA= X-Google-Smtp-Source: ABhQp+TBg83l96igMYQQJF6yBSTNXr0i93Ggl6dtRXc/eMNhmwCqrXrZr8GheKxxAyGAsq++WuD/WA== X-Received: by 10.55.0.136 with SMTP id t8mr6374692qkg.286.1509649562989; Thu, 02 Nov 2017 12:06:02 -0700 (PDT) Received: from localhost ([177.40.123.73]) by smtp.gmail.com with ESMTPSA id t93sm2481371qtd.45.2017.11.02.12.06.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2017 12:06:02 -0700 (PDT) From: Flavio Leitner To: dev@openvswitch.org Date: Thu, 2 Nov 2017 17:05:08 -0200 Message-Id: <20171102190509.2688-8-fbl@redhat.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171102190509.2688-1-fbl@redhat.com> References: <20171102190509.2688-1-fbl@redhat.com> 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 7/8] nlmon: added netns 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 Signed-off-by: Flavio Leitner --- utilities/nlmon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utilities/nlmon.c b/utilities/nlmon.c index 08a117b58..609b152f9 100644 --- a/utilities/nlmon.c +++ b/utilities/nlmon.c @@ -41,6 +41,7 @@ main(int argc OVS_UNUSED, char *argv[]) { uint64_t buf_stub[4096 / 64]; struct nl_sock *sock; + struct netns ns; struct ofpbuf buf; int error; @@ -57,9 +58,10 @@ main(int argc OVS_UNUSED, char *argv[]) ovs_fatal(error, "could not join RTNLGRP_LINK multicast group"); } + nl_sock_listen_all_nsid(sock, true); ofpbuf_use_stub(&buf, buf_stub, sizeof buf_stub); for (;;) { - error = nl_sock_recv(sock, &buf, NULL, false); + error = nl_sock_recv(sock, &buf, &ns, false); if (error == EAGAIN) { /* Nothing to do. */ } else if (error == ENOBUFS) { @@ -123,6 +125,11 @@ main(int argc OVS_UNUSED, char *argv[]) } } printf("\n"); + if (netns_is_remote(&ns)) { + printf("\tnetns id: %d\n", ns.id); + } else { + printf("\tnetns id: local\n"); + } if (attrs[IFLA_MASTER]) { uint32_t idx = nl_attr_get_u32(attrs[IFLA_MASTER]); char ifname[IFNAMSIZ];