From: John Kacur <jkacur@redhat.com>
To: Anubhav Shelat <ashelat@redhat.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 09/10] Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class
Date: Tue, 6 Jun 2023 11:22:35 -0400 (EDT) [thread overview]
Message-ID: <7cf09341-9f6e-cc2-6f77-eeffa1b7c2da@redhat.com> (raw)
In-Reply-To: <20230601202734.813515-10-ashelat@redhat.com>
On Thu, 1 Jun 2023, Anubhav Shelat wrote:
> Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class. If it doesn't, then the system has IPv6 disabled, and that chunk of code is passed.
>
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> ---
> rteval/sysinfo/newnet.py | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/rteval/sysinfo/newnet.py b/rteval/sysinfo/newnet.py
> index 63417d9e59f1..2911400ceb6c 100644
> --- a/rteval/sysinfo/newnet.py
> +++ b/rteval/sysinfo/newnet.py
> @@ -72,19 +72,23 @@ class IPv6Addresses():
> and a list of ipv6addresses
> '''
> MYP = '/proc/net/if_inet6'
> - with open(MYP, 'r') as f:
> - mystr = f.readline().strip()
> - while len(mystr) > 0:
> - ipv6addr , _, _, _, _, intf = mystr.split()
> - ipv6addr = compress_iv6(ipv6addr)
> - if intf == 'lo':
> - mystr = f.readline().strip()
> - continue
> - if intf not in self.data:
> - self.data[intf] = [ipv6addr]
> - else:
> - self.data[intf].append(ipv6addr)
> + try:
> + with open(MYP, 'r') as f:
> mystr = f.readline().strip()
> + while len(mystr) > 0:
> + ipv6addr , _, _, _, _, intf = mystr.split()
> + ipv6addr = compress_iv6(ipv6addr)
> + if intf == 'lo':
> + mystr = f.readline().strip()
> + continue
> + if intf not in self.data:
> + self.data[intf] = [ipv6addr]
> + else:
> + self.data[intf].append(ipv6addr)
> + mystr = f.readline().strip()
> + # if IPv6 is disabled, the if_net6 files does not exist, so we can pass
> + except FileNotFoundError:
> + pass
>
> class IPv4Addresses():
> ''' Obtains a list of IPv4 addresses from the proc file system '''
> --
Signed-off-by: John Kacur <jkacur@redhat.com>
next prev parent reply other threads:[~2023-06-06 15:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 20:27 [PATCH v2 00/10] Cover Letter Anubhav Shelat
2023-06-01 20:27 ` [PATCH v2 01/10] rteval: Use f-strings in rtevalclient.py Anubhav Shelat
2023-06-05 19:28 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 02/10] rteval: Use f-strings in rtevalConfig Anubhav Shelat
2023-06-05 19:31 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 03/10] rteval: Use f-strings in cputopology Anubhav Shelat
2023-06-12 18:32 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 04/10] rteval: Use f-strings in kernel.py Anubhav Shelat
2023-06-12 18:35 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 05/10] rteval: Use f-strings in memory.py Anubhav Shelat
2023-06-12 18:39 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 06/10] rteval: Use f-strings in osinfo Anubhav Shelat
2023-06-12 18:50 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 07/10] rteval: Use f-strings in services.py Anubhav Shelat
2023-06-12 18:58 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 08/10] rteval: Use f-strings in tools.py Anubhav Shelat
2023-06-12 18:59 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 09/10] Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class Anubhav Shelat
2023-06-06 15:22 ` John Kacur [this message]
2023-06-01 20:27 ` [PATCH v2 10/10] rteval: Use f-strings in __init__.py Anubhav Shelat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7cf09341-9f6e-cc2-6f77-eeffa1b7c2da@redhat.com \
--to=jkacur@redhat.com \
--cc=ashelat@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).