Bug 224920

Summary: limited broadcast for Linux programs
Product: Base System Reporter: Henry Hu <henry.hu.sh>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: emaste
Priority: ---    
Version: 11.1-STABLE   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 247219    

Description Henry Hu 2018-01-05 02:08:20 UTC
Limited broadcast, or sending to, is the behavior specified in RFC 947, which is deprecated (https://wiki.freebsd.org/NetworkRFCCompliance). As a result, FreeBSD does not support it (sending to results in an ether address of the default gw), unless IP_ONESBCAST is specified.
However, for Linux programs, it seems to be still expected to work. Some programs send UDP packets to to discover devices on local network. One such example is Canon's ScanGear MP program, which uses this way to discover local scanners.

Sample trace:

21:06:37.887917 b0:6e:bf:2a:e7:23 > 04:a1:51:15:5e:11, ethertype IPv4 (0x0800), length 166: >  C="canon_admin" GetRequest(104)  . . . . .


21:05:46.430205 b0:6e:bf:2a:e7:23 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 166: >  C="canon_admin" GetRequest(104)  . . . . .

Since FreeBSD does not support this, this program cannot discover any devices.
The discovery code is in some binary blob, which is unable to be changed. For a closer emulation of Linux behavior, I suggest that when running Linux programs, we send a broadcast packet to the interface of the default route.

A workaround is letting ipfw do a forward:

fwd udp from me to