OpenBSD CVS

CVS log for src/usr.sbin/dhcrelay/packet.c


[BACK] Up to [local] / src / usr.sbin / dhcrelay

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 5 14:40:56 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, HEAD
Changes since 1.13: +90 -59 lines
Diff to previous 1.13 (colored)

Rework the packet.c code for decoding and assembling DHCP messages.

This code suffered from many years of incremental improvements, fix it to:
- verify available buffer space in all cases and don't just trust the caller
- have an API where you always pass the full buffer length and absolute offset
- use consistent types for lengths and buffer offsets (int vs. size_t, ssize_t)
- don't just ignore errors, return and fail when something is wrong

OK rzalamena@

Revision 1.13 / (download) - annotate - [select for diffs], Mon Feb 13 19:15:39 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.12: +7 -6 lines
Diff to previous 1.12 (colored)

Switch from old errwarn.c logging to shiny new log.[ch].

ok benno@

Revision 1.12 / (download) - annotate - [select for diffs], Thu Dec 8 19:18:15 2016 UTC (7 years, 5 months ago) by rzalamena
Branch: MAIN
Changes since 1.11: +31 -27 lines
Diff to previous 1.11 (colored)

Clean up function prototypes: use a single struct to hold all address
information instead of passing multiple different parameters. This also
prepares the dhcrelay code to receive new features, like: IPv6, layer 2
relaying.

ok jca@

Revision 1.11 / (download) - annotate - [select for diffs], Sun Feb 7 00:49:28 2016 UTC (8 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.10: +14 -2 lines
Diff to previous 1.10 (colored)

Eliminate #include inside *.h files and include only needed headers in
each *.c file.

Inspired by mention of header silliness by Edgar Pettijohn and mmcc@
on tech@.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Feb 3 14:48:36 2016 UTC (8 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.9: +28 -7 lines
Diff to previous 1.9 (colored)

be very careful accepting packets via bpf. First check that the
fixed part of the IP header is completely present before using its
header length field.  Then use the data in the IP header to ensure
the entire IP packet is present. Then check that the entire UDP header
is present. Then use the data in the UDP header to ensure all the
data it thinks is present is actually present.

Started when tj@ and a few others noticed ISC "DHCP CVE-2015-8605:
UDP payload length not properly checked".

ok sthen@ henning@

Revision 1.9 / (download) - annotate - [select for diffs], Tue Feb 2 23:18:16 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.8: +10 -10 lines
Diff to previous 1.8 (colored)

Variables to count seen packets should be unsigned.

From dhcpd/packet.c r1.8   ok jca

Revision 1.8 / (download) - annotate - [select for diffs], Tue Feb 2 23:16:58 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.7: +4 -6 lines
Diff to previous 1.7 (colored)

Nuke local #define ETHER_HEADER_SIZE and use the identical value'd
ETHER_HDR_LEN from if_ether.h.

From dhcpd packet.c r1.6.  ok jca

Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 2 23:15:15 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.6: +22 -23 lines
Diff to previous 1.6 (colored)

Remove unused (a.k.a. always passed NULL) parameter 'data' from
decode_udp_ip_header() and the useless check of it. Part of original
diff from pelikan about udp length errors.

From dhcpd: bpf.c r1.9, dhcpd.h r1.46, packet.c r1.5

ok jca

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jan 13 13:41:42 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

"Check UDP length for short as well as long values" - apply the fix from
usr.sbin/dhcpd/packet.c r1.4 to dhcrelay.  ok deraadt@

Revision 1.5 / (download) - annotate - [select for diffs], Sat Oct 25 03:23:49 2014 UTC (9 years, 7 months ago) by lteo
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.4: +1 -2 lines
Diff to previous 1.4 (colored)

Remove unnecessary netinet/in_systm.h include.

ok millert@

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jul 28 16:40:32 2014 UTC (9 years, 10 months ago) by tobias
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.3: +4 -3 lines
Diff to previous 1.3 (colored)

merge dhcpd's packet.c revision 1.7:

Fix very hard to reach DoS attack vector, which would involve more than
8 billion network packets.  Mixture of many many malformed and proper
packets could result in a division by zero.

ok krw@

Revision 1.3 / (download) - annotate - [select for diffs], Thu Sep 3 11:56:49 2009 UTC (14 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.2: +21 -2 lines
Diff to previous 1.2 (colored)

Add support for "DHCP-over-IPsec" by implementing RFC 3046 (DHCP Relay
Agent Information Option) and RFC 3456 (DHCP Configuration of IPsec
Tunnel Mode).  This allows to configure various IPsec clients
dynamically via DHCP; dhcrelay needs to listen on enc0 and forward
requests to a DHCP server that supports RFC 3046, like I recently did
for dhcpd(8).

ok krw@

Revision 1.2 / (download) - annotate - [select for diffs], Tue Apr 20 20:56:47 2004 UTC (20 years, 1 month ago) by canacar
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.1: +5 -12 lines
Diff to previous 1.1 (colored)

get rid of the -p switch, use fixed values for server and client ports,
rename port variables for clarity.
ok henning@

Revision 1.1 / (download) - annotate - [select for diffs], Mon Apr 12 21:10:28 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN

initial cut at split out dhcrelay, whacked from usr.sbin/dhcp/ and sbin/dhclient

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.