Fix filtered exceptions when checking for ip forwarding (#76383)
authorRadek Zikmund <32671551+rzikm@users.noreply.github.com>
Fri, 30 Sep 2022 08:21:58 +0000 (10:21 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Sep 2022 08:21:58 +0000 (10:21 +0200)
src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxIPv4InterfaceProperties.cs

index 1a02bbe..de7b309 100644 (file)
@@ -52,8 +52,7 @@ namespace System.Net.NetworkInformation
                 {
                     return StringParsingHelpers.ParseRawIntFile(paths[i]) == 1;
                 }
-                catch (IOException) { }
-                catch (UnauthorizedAccessException) { }
+                catch (NetworkInformationException ex) when (ex.InnerException is IOException or UnauthorizedAccessException) { }
             }
 
             return false;