Fix UDP send to IPv6 link local addresses by nomis · Pull Request #6541 · esp8266/Arduino (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation9 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

nomis

lwIP's tcp/udp_connect() and tcp/udp_bind() functions automatically
set the zone if it is required but missing, but udp_connect() is not
used so this doesn't happen.

Explicitly set the zone to the default network interface if it is
required for the type of address being used. Otherwise there is no
zone set and packets to a link local destination don't go anywhere.

@d-a-v

Thanks !
What about a comment with your explanation ?
Did you try to simply call udp_connect() instead ?

@nomis

lwIP's tcp/udp_connect() and tcp/udp_bind() functions automatically set the zone if it is required but missing, but udp_connect() is not used so this doesn't happen.

Explicitly set the zone to the default network interface if it is required for the type of address being used. Otherwise there is no zone set and packets to a link local destination don't go anywhere.

@nomis

I've just tried using udp_connect() and lwIP isn't selecting the zone for a link local address because it tries to route to it and no source address has been provided... so it looks like TCP to link-local address won't currently work either.

@d-a-v

I had been testing TCP with fe80: and I remember it worked. Did you try ?

edit: didn't work after dedicated test (I might have tried the other way around)

@nomis

No, I've not tested TCP at all. Did you set or bind a source address explicitly?

If it works without specifying a source address then it would be reasonable to apply this fix so that UDP works too.

@d-a-v

No, I've not tested TCP at all. Did you set or bind a source address explicitly?

No.
I'd have to retry testing. You can too: take any tcp/http client example and change the address to your link-local IPv6 server address.

I assume this issue would exist only for client not server, but it can also be tried with server examples. Under linux, link-local server addresses must be extended with %intfname like fe80::%eth0.

@devyte

@devyte

d-a-v

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, IPv6 UDP packets to fe80:: do not leave esp (Udp.endPacket() == 0).
With this change, I can see them with tcpdump on my router.

@d-a-v

@d-a-v

This change is also necessary for TCP (credit will be given).
Merging for UDP.

d-a-v added a commit to d-a-v/Arduino that referenced this pull request

Apr 11, 2020

@d-a-v

@d-a-v d-a-v mentioned this pull request

Apr 11, 2020

d-a-v added a commit that referenced this pull request

Apr 11, 2020

@d-a-v