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

Fix use of undirected broadcast in FreeBSD. #94

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

xorrkaz
Copy link

@xorrkaz xorrkaz commented Aug 15, 2024

When you bind to a specific interface's IP in FreeBSD, you cannot use INADDR_BROADCAST as your destination. While the L3 address will be 255.255.255.255, the L2 address will be that of the gateway. Instead, use a directed broadcast and set the sockopt IP_ONESBCAST to support turning the directed broadcast into an undirected broadcast on the given interface.

Without this fix, MNDP listening works, but actually using MAC-Telnet to connect to devices does not.

When you bind to a specific interface's IP in FreeBSD, you cannot use
INADDR_BROADCAST as your destination.  While the L3 address will be
255.255.255.255, the L2 address will be that of the gateway.  Instead,
use a directed broadcast and set the sockopt IP_ONESBCAST to support
turning the directed broadcast into an undirected broadcast on the given
interface.

Without this fix, MNDP listening works, but actually using MAC-Telnet to
connect to devices does not.
@haakonnessjoen
Copy link
Owner

I don't have a freebsd box to test with, but I trust that you have tested this and it is working. Does the non-broadcast/raw packet part work on freebsd also? (-n option in mactelnet) which uses bpf.

@xorrkaz
Copy link
Author

xorrkaz commented Aug 16, 2024

Yes -n does work. It was just the sending of broadcast packets that wasn't working unless the µT router was your default gateway.

@haakonnessjoen haakonnessjoen merged commit 6d1f834 into haakonnessjoen:master Aug 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants