CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2018/07/05 23:47:22

Modified files:
        usr.sbin/tcpdump: interface.h print-bootp.c print-cnfp.c 
                          print-domain.c print-gtp.c print-iapp.c 
                          print-ike.c print-ipsec.c print-krb.c 
                          print-l2tp.c print-lwres.c print-ntp.c 
                          print-radius.c print-rip.c print-ripng.c 
                          print-snmp.c print-tftp.c print-udp.c 
                          print-udpencap.c print-vqp.c print-wb.c 

Log message:
Rework UDP parsing, particularly around IP addresses.

This originally started as trying to put a consistent space between
the UDP header information and the payload parsing, but while doing
that I noticed inconsistent IPv4 vs IPv6 handling.

Apart from the default "srcip.srcport > dstip.dstpor" output, all
the other places that IP addresses were printed assumed IPv4. It
looks like it is possible that udp_print() can be called without
an IP header, which made these blind IPv4 prints turn into NULL
derefs.

This fixes the problem above by only having a single place that
prints the addresses out, and makes sure to get the difference
between IPv4, IPv6 and no IP correct.

This changes how the checksum is calculated. It incrementally builds
the UDP checksum by feeding the IPv4 and v6 addresses in separately,
then using common code for the rest of the pseudo header and actual
payload.

Lastly, this does make printing the space between the UDP header
and its payload consistent. The UDP code is now responsible for
adding a space after itself so the payload parsers don't have to.
They got it wrong in some cases anyway, so this should be a lot
more uniform.

help and ok sthen@

Reply via email to