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

"insane mtu" setting for loopback #34

Open
tehfink opened this issue Apr 26, 2019 · 2 comments
Open

"insane mtu" setting for loopback #34

tehfink opened this issue Apr 26, 2019 · 2 comments

Comments

@tehfink
Copy link

tehfink commented Apr 26, 2019

Trying to run mdnsd on FreeBSD 11.2-RELEASE-p9 with a GENERIC Kernel, in a jail mounted on the loopback interface:

lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 172.16.10.10 netmask 0xfffffff0 
        groups: lo 

Results in this error:

# mdnsd -d lo1
startup
cache_insert: (new, cleaned up) (0x801c1c800) files [lo1:00:00:00:00:00:00]._workstation._tcp.local (SRV)
cache_insert: (new, cleaned up) (0x801c1cc00) files [lo1:00:00:00:00:00:00]._workstation._tcp.local (TXT)
using iface lo1 index 4
cache_insert: (new, cleaned up) (0x801c1d800) files.local (A)
cache_insert: (new, cleaned up) (0x801c1dc00) 10.10.16.172.in-addr.arpa (PTR)
cache_insert: (new, cleaned up) (0x801c1e000) files.local (HINFO)
opened raw socket with kernel on fd 5
mdns sock bound to 0.0.0.0:5353
if_fsm: event 'UP' resulted in action 'START' and changing state for interface lo1 from 'DOWN' to 'ACTIVE'
pkt_sendto: insane mtu
Can't send packet through lo1
can't send probe packet
pkt_sendto: insane mtu
Can't send packet through lo1
can't send probe packet
…
can't send announce packet

Changing the default mtu on the host works:

# ifconfig lo1 mtu 1500
# iocage console files
# ifconfig lo1
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 1500
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 172.16.10.10 netmask 0xfffffff0 
        groups: lo 
# mdnsd -d lo1
startup
cache_insert: (new, cleaned up) (0x801c1c800) files [lo1:00:00:00:00:00:00]._workstation._tcp.local (SRV)
cache_insert: (new, cleaned up) (0x801c1cc00) files [lo1:00:00:00:00:00:00]._workstation._tcp.local (TXT)
using iface lo1 index 4
cache_insert: (new, cleaned up) (0x801c1d800) files.local (A)
cache_insert: (new, cleaned up) (0x801c1dc00) 10.10.16.172.in-addr.arpa (PTR)
cache_insert: (new, cleaned up) (0x801c1e000) files.local (HINFO)
opened raw socket with kernel on fd 5
mdns sock bound to 0.0.0.0:5353
if_fsm: event 'UP' resulted in action 'START' and changing state for interface lo1 from 'DOWN' to 'ACTIVE'

But, now all the other jails must use the lower mtu setting.

@twinshadow
Copy link

You can fix this by changing the value of MAXPACKET in mdnsd/packet.c to a larger value. I don't know the reasoning behind the current value, so I'll do some more research before submitting a PR.

diff --git i/mdnsd/packet.c w/mdnsd/packet.c
index 7472836..1a3a7db 100644
--- i/mdnsd/packet.c
+++ w/mdnsd/packet.c
@@ -51,7 +51,7 @@
 #define NAMECOMP_MSK   0xc000
 #define NAMEADDR_MSK   ~0xc000
 #define MAXLABELS      128
-#define MAXPACKET      10000
+#define MAXPACKET      65535
 #define HDR_LEN                12
 #define MINQRY_LEN     6 /* 4 (qtype + qclass) +1 (null) + 1 (label len) */
 /* Defer truncated packets from 400ms-500ms */

@twinshadow
Copy link

Currently the functions recv_packet and pkt_sendto allocate the buffer on the stack using buf[MAXPACKET]. Instead, they should be allocating the buffer based on the size of the interface MTU.

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

No branches or pull requests

2 participants