freebsd-dev/sys/net
Alexander V. Chernikov 3deb3649d5 Fix incorrect netmasks being passed via rtsock.
Since radix has been ignoring sa_family in passed sockaddrs,
no one ever has bothered filling valid sa_family in netmasks.
Additionally, radix adjusts sa_len field in every netmask not to
compare zero bytes at all.

This leads us to rt_mask with sa_family of AF_UNSPEC (-1) and
arbitrary sa_len field (0 for default route, for example).

However, rtsock have been passing that rt_mask intact for ages,
requiring all rtsock consumers to make ther own local hacks.
We even have unfixed on in base:

do `route -n monitor` in one window and issue `route -n get addr`
for some directly-connected address. You will probably see the following:

got message of size 304 on Thu May  8 15:06:06 2014
RTM_GET: Report Metrics: len 304, pid: 30493, seq 1, errno 0, flags:<UP,DONE,PINNED>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 10.0.0.0 link#1 (255) ffff ffff ff em0:8.0.27.c5.29.d4 10.0.0.92
_________________^^^^^^^^^^^^^^^^^^

after the change:

got message of size 312 on Thu May  8 15:44:07 2014
RTM_GET: Report Metrics: len 312, pid: 2895, seq 1, errno 0, flags:<UP,DONE,PINNED>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 10.0.0.0 link#1 255.255.255.0 em0:8.0.27.c5.29.d4 10.0.0.92
_________________^^^^^^^^^^^^^^^^^^

Sponsored by:	Yandex LLC
MFC after:	1 month
2014-05-08 11:56:06 +00:00
..
bpf_buffer.c
bpf_buffer.h
bpf_filter.c
bpf_jitter.c
bpf_jitter.h
bpf_zerocopy.c
bpf_zerocopy.h
bpf.c
bpf.h
bpfdesc.h
bridgestp.c
bridgestp.h
ethernet.h
fddi.h
firewire.h
flowtable.c
flowtable.h
ieee8023ad_lacp.c
ieee8023ad_lacp.h
ieee_oui.h
if_arc.h
if_arcsubr.c
if_arp.h
if_atm.h
if_atmsubr.c
if_bridge.c
if_bridgevar.h
if_clone.c
if_clone.h
if_dead.c
if_debug.c
if_disc.c
if_dl.h
if_edsc.c
if_enc.c
if_enc.h
if_epair.c
if_ethersubr.c
if_faith.c
if_fddisubr.c
if_fwsubr.c
if_gif.c
if_gif.h
if_gre.c
if_gre.h
if_iso88025subr.c
if_lagg.c
if_lagg.h
if_llatbl.c
if_llatbl.h
if_llc.h
if_loop.c
if_media.c
if_media.h
if_mib.c
if_mib.h
if_pflog.h
if_pfsync.h
if_sppp.h
if_spppfr.c
if_spppsubr.c
if_stf.c
if_stf.h
if_tap.c
if_tap.h
if_tapvar.h
if_tun.c
if_tun.h
if_types.h
if_var.h
if_vlan_var.h
if_vlan.c
if.c
if.h
ifq.h
iso88025.h
netisr_internal.h
netisr.c
netisr.h
netmap_user.h
netmap.h
pfil.c
pfil.h
pfkeyv2.h
pfvar.h
ppp_defs.h
radix_mpath.c
radix_mpath.h
radix.c
radix.h
raw_cb.c
raw_cb.h
raw_usrreq.c
route.c
route.h
rtsock.c Fix incorrect netmasks being passed via rtsock. 2014-05-08 11:56:06 +00:00
sff8472.h
slcompress.c
slcompress.h
vnet.c
vnet.h
zlib.c
zlib.h
zutil.h