Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinuxNetworkInterface.GetLinuxNetworkInterfaces - An invalid IP address was specified. #49515

Closed
BaronGreenback opened this issue Mar 11, 2021 · 14 comments
Labels
area-System.Net needs-author-action An issue or pull request that requires more info or actions from the author. os-linux Linux OS (any supported distro)
Milestone

Comments

@BaronGreenback
Copy link

.NET 5

Got this error reported today: jellyfin/jellyfin#5454

Today I updated my NAS (Helios Kobol64 Armbian 10 Buster aarch64). After the upgrade from 10.6. to 10.7.0 I wasn't able to start Jellyfin anymore.

Mär 11 07:47:40 kobold jellyfin[4209]: [07:47:40] [FTL] [1] Main: Unhandled Exception Mär 11 07:47:40 kobold jellyfin[4209]: System.ArgumentException: An invalid IP address was specified. (Parameter 'address') Mär 11 07:47:40 kobold jellyfin[4209]: at System.Net.IPAddress..ctor(ReadOnlySpan1 address)
Mär 11 07:47:40 kobold jellyfin[4209]: at System.Net.NetworkInformation.LinuxNetworkInterface.GetLinuxNetworkInterfaces()
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager.InitialiseInterfaces()
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager.UpdateSettings(Object configuration)
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager..ctor(IConfigurationManager configurationManager, ILogger1 logger) Mär 11 07:47:40 kobold jellyfin[4209]: at Emby.Server.Implementations.ApplicationHost..ctor(IServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IStartupOptions options, IConfiguration startupConfig, IFileSystem fileSystem, IServiceCollection serviceCollection) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.CoreAppHost..ctor(IServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IStartupOptions options, IConfiguration startupConfig, IFileSystem fileSystem, IServiceCollection collection) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.Program.StartApp(StartupOptions options) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.Program.<Main>(String[] args)

He's posted the network settings on his device as

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:08:9b:f0:0b:a1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.207/24 brd 192.168.1.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fd00:0:0:1::207/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::1aff:c6f8:b727:b587/64 scope link 
       valid_lft forever preferred_lft forever
    inet6 fe80::208:2aff:feff:6739/64 scope link 
       valid_lft forever preferred_lft forever
3: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:08:9b:f0:0b:a2 brd ff:ff:ff:ff:ff:ff

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 64:62:66:d0:05:ac brd ff:ff:ff:ff:ff:ff
    inet 192.168.109.10/24 brd 192.168.109.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.109.50/24 brd 192.168.109.255 scope global secondary dns
       valid_lft forever preferred_lft forever
    inet 192.168.109.51/24 brd 192.168.109.255 scope global secondary nfs
       valid_lft forever preferred_lft forever
    inet 192.168.109.52/24 brd 192.168.109.255 scope global secondary oscam
       valid_lft forever preferred_lft forever
    inet 192.168.109.53/24 brd 192.168.109.255 scope global secondary tvheadend
       valid_lft forever preferred_lft forever
    inet6 fe80::6662:66ff:fed0:5ac/64 scope link 
       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 64:62:66:d0:05:ad brd ff:ff:ff:ff:ff:ff

Code starts at https://github.com/jellyfin/jellyfin/blob/8615847a8aba1f504b184e79907e6885215ffdaa/Jellyfin.Networking/Manager/NetworkManager.cs#L1051

Any ideas?

@blowdart blowdart transferred this issue from dotnet/aspnetcore Mar 11, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Mar 11, 2021
@ghost
Copy link

ghost commented Mar 11, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

.NET 5

Got this error reported today: jellyfin/jellyfin#5454

Today I updated my NAS (Helios Kobol64 Armbian 10 Buster aarch64). After the upgrade from 10.6. to 10.7.0 I wasn't able to start Jellyfin anymore.

Mär 11 07:47:40 kobold jellyfin[4209]: [07:47:40] [FTL] [1] Main: Unhandled Exception Mär 11 07:47:40 kobold jellyfin[4209]: System.ArgumentException: An invalid IP address was specified. (Parameter 'address') Mär 11 07:47:40 kobold jellyfin[4209]: at System.Net.IPAddress..ctor(ReadOnlySpan1 address)
Mär 11 07:47:40 kobold jellyfin[4209]: at System.Net.NetworkInformation.LinuxNetworkInterface.GetLinuxNetworkInterfaces()
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager.InitialiseInterfaces()
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager.UpdateSettings(Object configuration)
Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Networking.Manager.NetworkManager..ctor(IConfigurationManager configurationManager, ILogger1 logger) Mär 11 07:47:40 kobold jellyfin[4209]: at Emby.Server.Implementations.ApplicationHost..ctor(IServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IStartupOptions options, IConfiguration startupConfig, IFileSystem fileSystem, IServiceCollection serviceCollection) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.CoreAppHost..ctor(IServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IStartupOptions options, IConfiguration startupConfig, IFileSystem fileSystem, IServiceCollection collection) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.Program.StartApp(StartupOptions options) Mär 11 07:47:40 kobold jellyfin[4209]: at Jellyfin.Server.Program.<Main>(String[] args)

He's posted the network settings on his device as

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:08:9b:f0:0b:a1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.207/24 brd 192.168.1.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fd00:0:0:1::207/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::1aff:c6f8:b727:b587/64 scope link 
       valid_lft forever preferred_lft forever
    inet6 fe80::208:2aff:feff:6739/64 scope link 
       valid_lft forever preferred_lft forever
3: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:08:9b:f0:0b:a2 brd ff:ff:ff:ff:ff:ff

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 64:62:66:d0:05:ac brd ff:ff:ff:ff:ff:ff
    inet 192.168.109.10/24 brd 192.168.109.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.109.50/24 brd 192.168.109.255 scope global secondary dns
       valid_lft forever preferred_lft forever
    inet 192.168.109.51/24 brd 192.168.109.255 scope global secondary nfs
       valid_lft forever preferred_lft forever
    inet 192.168.109.52/24 brd 192.168.109.255 scope global secondary oscam
       valid_lft forever preferred_lft forever
    inet 192.168.109.53/24 brd 192.168.109.255 scope global secondary tvheadend
       valid_lft forever preferred_lft forever
    inet6 fe80::6662:66ff:fed0:5ac/64 scope link 
       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 64:62:66:d0:05:ad brd ff:ff:ff:ff:ff:ff

Code starts at https://github.com/jellyfin/jellyfin/blob/8615847a8aba1f504b184e79907e6885215ffdaa/Jellyfin.Networking/Manager/NetworkManager.cs#L1051

Any ideas?

Author: BaronGreenback
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@wfurt wfurt added the os-linux Linux OS (any supported distro) label Mar 12, 2021
@wfurt
Copy link
Member

wfurt commented Mar 12, 2021

I don't see anything suspicious in the output. I look at the IPAddress() ctor and it would throw ArgumentException only if the address length is neither IPv4 nor IPv6. Matching PAL code uses only those two constant. So that is curious.

I think the way to debug would be creating simple self-contained app that only gets the interfaces and step through in debugger. Since this is ARM, I'm wondering if there is alignment issue...

@karelz
Copy link
Member

karelz commented Mar 18, 2021

@BaronGreenback can you please try to debug it? If we know the root cause (e.g. alignment as @wfurt suggested above), we can help with a fix.
There does not seem much we can do from the information provided above.

@karelz karelz added needs more info and removed untriaged New issue has not been triaged by the area owner labels Mar 18, 2021
@karelz karelz added this to the 6.0.0 milestone Mar 18, 2021
@BaronGreenback
Copy link
Author

@BaronGreenback can you please try to debug it? If we know the root cause (e.g. alignment as @wfurt suggested above), we can help with a fix.
There does not seem much we can do from the information provided above.

The error isn't produced on my kit - it's a bug report from one of our users. - I'll put something together for him - based on the original dotnet source to see if i can get some output.

@BaronGreenback
Copy link
Author

BaronGreenback commented Mar 25, 2021

Just updating - wrote some code for the user, that outputs the info it's receiving from

[DllImport("libSystem.Native", EntryPoint = "SystemNative_GetNetworkInterfaces")]
public static unsafe extern int GetNetworkInterfaces(ref int count, ref NetworkInterfaceInfo* addrs, ref int addressCount, ref IpAddressInfo* aa);

It looks like its getting all zero's for the address. Have modified the test code again - and asked for it to be re-run.

Will let you know the outcome.

@wfurt
Copy link
Member

wfurt commented Mar 25, 2021

thanks for update. Is addressCount set and does it match expected address count? (should be sum of IPv4 & IPv6 address)

@BaronGreenback
Copy link
Author

It's come back with 4 interfaces. There are 5 on the system , but i don't know if the last one would have an entry.

lo: 1 IPv4, 1 IPv6
eth0: 5 IPv4, 1 IPv6
eth1: not configured, not connected.

@BaronGreenback
Copy link
Author

BaronGreenback commented Mar 28, 2021

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 64:62:66:d0:05:ac brd ff:ff:ff:ff:ff:ff
inet 192.168.109.10/24 brd 192.168.109.255 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.109.50/24 brd 192.168.109.255 scope global secondary dns
valid_lft forever preferred_lft forever
inet 192.168.109.51/24 brd 192.168.109.255 scope global secondary nfs
valid_lft forever preferred_lft forever
inet 192.168.109.52/24 brd 192.168.109.255 scope global secondary oscam
valid_lft forever preferred_lft forever
inet 192.168.109.53/24 brd 192.168.109.255 scope global secondary tvheadend
valid_lft forever preferred_lft forever
inet6 fe80::6662:66ff:fed0:5ac/64 scope link
valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 64:62:66:d0:05:ad brd ff:ff:ff:ff:ff:ff

@BaronGreenback
Copy link
Author

BaronGreenback commented Mar 28, 2021

Ok this is the info returned from

[DllImport("libSystem.Native", EntryPoint = "SystemNative_GetNetworkInterfaces")]
public static unsafe extern int GetNetworkInterfaces(ref int count, ref NetworkInterfaceInfo* addrs, ref int addressCount, ref IpAddressInfo* aa);

Name: lo
Speed:-1
Idx: 1
MTU:65536
Type:Loopback
Speed:Up
Multicast:0
Number of Bytes:6
Physical Address:000000000000

Name: eth0
Speed:1000000000
Idx: 2
MTU:1500
Type:Ethernet
Speed:Up
Multicast:1
Number of Bytes:6
Physical Address:646266D005AC

Name: eth1
Speed:4294967295000000
Idx: 3
MTU:1500
Type:Ethernet
Speed:Down
Multicast:1
Number of Bytes:6
Physical Address:646266D005AD

Name: dns
Speed:-1
Idx: 0
MTU:174958784
Type:Unknown
Speed:Up
Multicast:1

Error parsing IP
System.ReadOnlySpan[255]
Scopeid: 7564900
PrefixLength:255

Error parsing IP
System.ReadOnlySpan[1]
Scopeid: 0
PrefixLength:24

192.168.109.50
PrefixLength:24

192.168.109.51
PrefixLength:24

192.168.109.52
PrefixLength:24

192.168.109.53
PrefixLength:24

::1
PrefixLength:128

fe80::6662:66ff:fed0:5ac
Scopeid: 2
PrefixLength:64

Code used to get these result is at https://github.com/BaronGreenback/TestRepo

@wfurt
Copy link
Member

wfurt commented Mar 29, 2021

do you know how the dns interface is created? I'll try to reproduce. I think I have general idea what is going on.
There is some discrepancy between the first output (I assume ip link) vs the second e.g. ip address. One uses the new naming e.g. enp3s0 but the other shows old style e.g. 'eth0'. I'm wondering if brctl show would show something interesting.

And no, the Java bug is not relevant as we no longer read and parse /proc entries.

@BaronGreenback
Copy link
Author

From the user

_I've configured the network via systemd-networkd:

cat /etc/systemd/network/eth0.network

[Match]
Name=eth0

[Network]
Address=192.168.109.10/24
Gateway=192.168.109.1
#DNS=127.0.0.1 # statically set to avoid conflict with local DNS server
DNS=192.168.109.11
Domains=blechnet.de

[Address]
Label=dns
Address=192.168.109.50/24

[Address]
Label=nfs
Address=192.168.109.51/24

[Address]
Label=oscam
Address=192.168.109.52/24

[Address]
Label=tvheadend
Address=192.168.109.53/24
I'm using service IPs (labels) to separate services from the main IP of the hardware device. This is common practice. I could have also used CNames. But service IPs have several advantages.

Also there's no "new and old naming". enp3s0 is a Predictable Network Interface Name while eth0 isn't. If the network cards don't change in the device, there's no need to use predictable network interface names.

brctl show gives an empty output, because there's no bridge configured._

@wfurt
Copy link
Member

wfurt commented Mar 31, 2021

"Predictable Network Interface Name " -> that what I call new. (I know it is around for a while now)
I was trying to mimic your setup on my Ubuntu VM but no luck so far.

When I add secondary/alias address to interface via ip command it does not show up as interface in GetLinuxNetworkInterfaces(). It is also curious that some L3 addresses are attached to eth0 and some to enp3s0.
From the last dump it seems like the inet6 fd00:0:0:1::207/64 scope global and inet6 fe80::1aff:c6f8:b727:b587/64 scope link is missing so it may be come clue. I did not figure out (yet?) how to bind the predictable name with eth0

Any chance you have similar setup on x64 and/or you know how to mimic it with ip utility @BaronGreenback.
I'm trying to figure out how to reproduce this and if arm CPU is needed or not.

@karelz karelz modified the milestones: 6.0.0, Future May 6, 2021
@ghost ghost added the no-recent-activity label Oct 9, 2021
@ghost
Copy link

ghost commented Oct 9, 2021

This issue has been automatically marked no recent activity because it has been marked as needs more info but has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no recent activity.

Please refer to our contribution guidelines for tips on what information might be required.

@ghost
Copy link

ghost commented Nov 5, 2021

This issue will now be closed since it had been marked no recent activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@ghost ghost closed this as completed Nov 5, 2021
@karelz karelz modified the milestones: Future, 7.0.0 Nov 23, 2021
@ghost ghost removed the no-recent-activity label Nov 23, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 23, 2021
@eiriktsarpalis eiriktsarpalis added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jan 19, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net needs-author-action An issue or pull request that requires more info or actions from the author. os-linux Linux OS (any supported distro)
Projects
None yet
Development

No branches or pull requests

4 participants