From patchwork Thu Feb 8 17:26:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13550232 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B5A682D9A for ; Thu, 8 Feb 2024 17:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; cv=none; b=h4Zodz68yPLtohJxnK2WUPZRFG5WWTk8W6RzRQ5XGPSHgSnbOS7FOLrmVVgNjPj6sgg1oK7thCjdqyEOwCAERRCIqHE1I6HK5pRT5ZMXgQKt1YGLiaEE2dJKojss5wc1Oba8DOaTK6lUns9QdI6zhYSzqshD5XP22zJMW7jmTTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; c=relaxed/simple; bh=sAUcYMJMyzFIiyiV+W23YViwmOLGkJIxgCN9P9C4P7g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gfejkfZJFYMa+EosClhgm72skF/LAY3JBlMTJy4QuHZbK44dTcHcw6H6HE2BFQrTXz3SHFa0gK2+1rKwUuNA3uT7q0HbSp5FG561ezPaFyqpmLNUmqbAoOSo91Q7rVzrT4pf71S76nLvMx+JZzyVjaIBU0yzD/jdtc5fXNTIvjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=uAnoltDl; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="uAnoltDl" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d71cb97937so76705ad.3 for ; Thu, 08 Feb 2024 09:26:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1707413217; x=1708018017; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sDMUhkhn6m1E5wpu6uGtdgKk5XvzlhzIOpvLeEmDVgI=; b=uAnoltDlZHJHRvArCSm3VUyS4UqVEYYAsGs5sELtiFPQe+9yzC1VB40BwyGzLfqqb+ LC35Y7CNPO/sSp+71hApPQWAA2YQH0JHF3mbowWpi1MYJ7LA+o1lfpBh88r+FPTMyj57 GDItKNPnbSvSWO6JJjdaiXgDEVgqnKk0NcAo0NcT0WT77i+HPABXdGu2M1FgI2ctBw5q 5FYDRJpx7ZhKjgMsBpF+2Cw6h5ok1P0IoEp0XI2FJd5W7jWpCFVzzamwW8KP3ZOmD+G/ qTNRTPBKf2xnEB5x6B6pGq2XVkXg0ho/UZPvQTAJ0C4nd6rQRJO9B3c3qi7zxsPhVgVN zlyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707413217; x=1708018017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sDMUhkhn6m1E5wpu6uGtdgKk5XvzlhzIOpvLeEmDVgI=; b=fx0jHW841MxDWlxJwFhCT3CBRVWDLae567G7CjA1C+ZO+M4GemCrTpOoVBejvFZQLV RAknFIo6b+UoiQHF7b1tfMxUELLPAEsuGcZKqUXbZgSFene/fK51RwfDJsbgkuD9Brjt os/5JvAgrSZ5b6mUl4x5bc6eGo4o0ykVoFtejsfMJEGJXi6fz5MpjuIm3C/O432FAmqe NUWJ/NwOaIQ4MR6l1wcxabJzFTGram/U6WurewK751uCZ3nM/dc3sq75Re6L0YRzWe7J GIQ8AZyzhD6VEUMWvwru0BoP2ljnFSdkFHB2M+RpVq4/MqcDckCoEsj3viguBHcLjq4G BE6w== X-Gm-Message-State: AOJu0Yw2On3Cwnc36X8GZ3dUuBSVV480LRgwhPTkrSUAvC59ZxQVlPif OkfWOTwC8R2K7QtFkiFWTcUUHcDybBFCtNB7XwETqwzn1btSAbe3n4k5udkvp1AHxB4fU3diRV3 BIis= X-Google-Smtp-Source: AGHT+IHfcwupqHhTPu8cr0mqIpBdXCrNvQ/CQpYmcmLCyqFGNtHhjmDFeZx1/vmBRuyckznHQg3D/w== X-Received: by 2002:a17:902:e751:b0:1d9:727d:e84f with SMTP id p17-20020a170902e75100b001d9727de84fmr11371126plf.47.1707413217677; Thu, 08 Feb 2024 09:26:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWfMR6h+KCM6J91q/bWGUjmeqHK//gZ+xUWN02uKxXZDia76tVjJcmvH/HiRp3pHzzUm/mTlkVwvwpMMQKSqxwl368rww5oVMAczA== Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id g14-20020a170902f74e00b001d9d4375149sm42265plw.215.2024.02.08.09.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:26:57 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Maks Mishin , Maks Mishin , Stephen Hemminger Subject: [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() Date: Thu, 8 Feb 2024 09:26:27 -0800 Message-ID: <20240208172647.324168-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com From: Maks Mishin Use the same pattern for handling rtnl_listen() errors that is used across other iproute2 commands. All other commands exit with status of 2 if rtnl_listen fails. Reported-off-by: Maks Mishin Signed-off-by: Stephen Hemminger --- genl/ctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/genl/ctrl.c b/genl/ctrl.c index bae73a54bc37..72a9b01302cf 100644 --- a/genl/ctrl.c +++ b/genl/ctrl.c @@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv) } if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0) - return -1; - + exit(2); + + rtnl_close(&rth); return 0; } From patchwork Thu Feb 8 17:26:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13550231 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2796C82D8C for ; Thu, 8 Feb 2024 17:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; cv=none; b=GRAuxlC9px8k0lqmNIm3SuVITd499gA0xtZuKup9TtXIUlHP1O2lAKAzuuIz86DZMrnY7nHGe2zH5DZoAmtmTpcTgdM8mWrw7OEVms2VFtCQZhgSoSB7iAl2wsIZXU02ym8ZMgDSLtJe0zD8MFvy3RBTXa+Zz7rox587J9k6XqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; c=relaxed/simple; bh=AG8jG6dAnrcRElapPLvkRRBQUOO7ZJsaMCUziJj/mIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CWzfrtUJd1/b7QdTGKLqwhewtJGeteXecPY0NJXuGI0+MuLITC2NG1XEjF8GELrM7lkPOMfEUh5EbLHbeKJqODctS6KAxxqwFeooCPVL1VVCLHye8sXRl2Lqn6fZDhSSHQoWp83o15Vn5bHzd8Gpe5iJloWcEfZk+WpqyG+D87Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=3WOcK9m7; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="3WOcK9m7" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d751bc0c15so36325ad.2 for ; Thu, 08 Feb 2024 09:26:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1707413218; x=1708018018; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vd5Y0BCj/r3EVE4i6V+IZkFH+Ey+uHymlZ8rC/cUF+E=; b=3WOcK9m7a6/UEdwz3oduy4PgJJcmcP6769fLzqqNfI0ThPerPCK/w7dI4gYDv1iqHv 9a17wbMx7JgDsYAuIbGQoz+j1JCn5B3vWAAvFInWTxcGILUCk9gr/IsnpV7CuVrGV0X4 Bzj1SARYCvbuJdIODlwq0OC28Jh0Uz8bY3TTsrwqzaolbETEBnKvTzSLhdrI8DIEqBhG E6yLNOjufuKKb4scxzj6Kcmv6WJe+YjhBHjSbyutzXpxiyzP7YkfzDFUqA7U5e3R50Qa AT8+BpFmjxiDsj5zz1CTbHKrukFU5e5UWAkcieJmGsOE4Ptuk/neqYmB9vlNWbP5+Thc FDUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707413218; x=1708018018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vd5Y0BCj/r3EVE4i6V+IZkFH+Ey+uHymlZ8rC/cUF+E=; b=vNeIpplJbArxuASxxx+29tfcRdqFmLRo5U1+gPnVBauwwjGaVorP8Rk+gDTH8g6TQB maP3/wRIySbHRyI6cYhVZ9cDnmRyZLxo9ugyAUBu/SwIxZmcyGqQs+Wn3DMSSWL1ZDyL ZOFZ21NCeLukfgSKms4aZSklH6LkCR61YO93g7I/Isj/CsYDoyUSQrjoUD01n6OLB/rc SEHhv3IU5OFCcgkGpiiA5ExTDDOm3/0Auq5lsuuf6mSwDDGX1ItY8vvkCgTnuC9aDdRv UyaUDFdxJkMB8NZ2oI/c58m9o8aBpHIZ3Sly0/brsuJWEdAvCoBlREFgE261PIo9jvQ/ H5ZQ== X-Gm-Message-State: AOJu0YxAoQwp/c2JuGcKWW8vx9inXhWZ7L8/hhoKykjjb/43UMUd7IFy iIE+oWvjonJ06Eu0nFeJWOyEXeZJA11qtZDxAHq/VikNsCYI1plJ2+861t5IJdjz+tyxHSzyKkc Q4kU= X-Google-Smtp-Source: AGHT+IFeyoHYMLPR9x523CVQ37x9vPYaNBhnE2DjpqhYvBuD1UGazegjNNIFA43dvCOOF6S4fQ3gyQ== X-Received: by 2002:a17:902:d550:b0:1d9:a148:49c with SMTP id z16-20020a170902d55000b001d9a148049cmr10371879plf.57.1707413218313; Thu, 08 Feb 2024 09:26:58 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id g14-20020a170902f74e00b001d9d4375149sm42265plw.215.2024.02.08.09.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:26:58 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode Date: Thu, 8 Feb 2024 09:26:28 -0800 Message-ID: <20240208172647.324168-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208172647.324168-1-stephen@networkplumber.org> References: <20240208172647.324168-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com If rtnl_listen() returns error while looking for netconf events, then exit with status of 2 as other iproute2 monitor actions do. Signed-off-by: Stephen Hemminger --- ip/ipnetconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c index 9ae6c45e7fd1..a0c7e051bac5 100644 --- a/ip/ipnetconf.c +++ b/ip/ipnetconf.c @@ -193,7 +193,8 @@ static int do_show(int argc, char **argv) perror("Can not send request"); exit(1); } - rtnl_listen(&rth, print_netconf, stdout); + if (rtnl_listen(&rth, print_netconf, stdout) < 0) + exit(2); } else { rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR; dump: From patchwork Thu Feb 8 17:26:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 13550233 X-Patchwork-Delegate: stephen@networkplumber.org Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA76C82D80 for ; Thu, 8 Feb 2024 17:26:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; cv=none; b=MZ28di8inIJ4E7QSIkuXOVGpfVyZnbO0EZDH9iMO9WrS/qO7yCxQ9+zKpjHFmpniMACUJyaI/1hRSY3erkAycysNG2BNmUU/tQ5BbPyj4nXYGlmBjpKBZyHJ07MfyJ6nRkM5X+deadgdekHeVd3ctl9GJzo4RTWvy8yUxdEFDmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413221; c=relaxed/simple; bh=0sjHTzzr+dbcbbs7st9ExWkm7Ltx/7R4IK6V1Jxa52c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oOiMV8Sf4vdR1f3O98TP5OjCilzvdvA8YZTaQp8ZdmSgdx+LrTh0v/cCKpSZmTLnc3whtlXka/X6vmHsdJGexlRJQOmp8yoYc+pmyZIFM6M588OaQ4lP161EdYKZcxDUGVCEnn65XpPcD0rxBZPqaznKAVGVEQ8NZYYPLa1uUCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b=kUu//KbQ; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20230601.gappssmtp.com header.i=@networkplumber-org.20230601.gappssmtp.com header.b="kUu//KbQ" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d918008b99so15465ad.3 for ; Thu, 08 Feb 2024 09:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1707413219; x=1708018019; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TnMiPqmjn/oepx8HbNSJF8pOdO7gvdJPOYCj2/WsvRg=; b=kUu//KbQbMOHtOOW+/cUZ0/IfleKZIueGTCmo3fS4/7Xd6d3x4hduBRc+ogbSrEUHF dFywDSsGbxUjVxQejpzdW38dI0FrI/KjfvzPWEzHKYeOZd4wj1zIGCecy4J6rkk4rWA6 pcKGiWR1Q84Ovz618cZU38wMj2F1R12NHgJ9s23XsQjc/S7jxIbuXwgl8Q25Q1Vo2m9U TdatHKRM/fbStzm2EG1Drb8Cm0XNS0kNuMID6vaDcsJFUOPyhqut9VdcMACkWY5S/TCi +pulRz1Ef9Nk2QOZeLzupihjhbOe5yx7LQ+EQ0QI/qyFQKgsaZHh9bKmSW6VVv7AapZL T98Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707413219; x=1708018019; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TnMiPqmjn/oepx8HbNSJF8pOdO7gvdJPOYCj2/WsvRg=; b=d8WwX96tKHtYOmYx4sl3yCe+Pl4hPkikvc6J4eYWPqAmzCQ15uyOVSRYs/MrDou5Jx MYRCxNnEwtJOWvFrfDECU0IZcMxR9Jh4Ww+9hgOISDWT6YvfyucXUohGSSMoihQxsoBM GG8PzBVviVEW3hYXlgJdlG/Ec3+QqDX8TlaKF0/noSbG2AqfszL1inbVtwZM51aGIG+o 39svokXYCCNIb1+nK3tGPaPUx8C54J0uVCC55vie/ckGlPPSrUGUZqpomrDJ6YMNCU0Z zmZNOaEfVmwxSP8fBgFzwazeF++aSSi4IGgk1s5/SBqkEyfSzPX8A2jLSH47lOcPMTpm 42gQ== X-Gm-Message-State: AOJu0YxIvg3UJFfkaUEXGrsK7P0WAFGQ9Swb68URIL/DB9dQBXCYOw3P WjaOv7LxNeBmm6tvLzHRH+N27BYr7lz2HjfMuyy4/FTyNuRVm4r0KrUGD+uyM72w+tmIwWbcBo/ cY3w= X-Google-Smtp-Source: AGHT+IE1sco5gKCgkeefCH6kM6qGG7W40SUUjeUdPjoItgVKYaEvZRZhSfcnDafE2YeseVHo437J0g== X-Received: by 2002:a17:902:6849:b0:1d7:8382:322e with SMTP id f9-20020a170902684900b001d78382322emr9411561pln.56.1707413218890; Thu, 08 Feb 2024 09:26:58 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id g14-20020a170902f74e00b001d9d4375149sm42265plw.215.2024.02.08.09.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:26:58 -0800 (PST) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 3/3] ip: detect rtnl_listen errors while monitoring netns Date: Thu, 8 Feb 2024 09:26:29 -0800 Message-ID: <20240208172647.324168-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208172647.324168-1-stephen@networkplumber.org> References: <20240208172647.324168-1-stephen@networkplumber.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com If rtnl_listen detects error (such as netlink socket EOF), then exit with status 2 like other iproute2 monitor commands. Signed-off-by: Stephen Hemminger --- ip/ipnetns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 0ae46a874a0c..594b2ef15d0c 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -96,7 +96,8 @@ static int ipnetns_have_nsid(void) close(fd); return 0; } - rtnl_listen(&rth, ipnetns_accept_msg, NULL); + if (rtnl_listen(&rth, ipnetns_accept_msg, NULL) < 0) + exit(2); close(fd); }