OpenBSD CVS

CVS log for src/sbin/dhclient/packet.c


[BACK] Up to [local] / src / sbin / dhclient

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.45 / (download) - annotate - [select for diffs], Mon Feb 22 23:43:59 2021 UTC (3 years, 3 months ago) by jsg
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, HEAD
Changes since 1.44: +1 -16 lines
Diff to previous 1.44 (colored)

remove unused decode_hw_header() function

ok krw@

Revision 1.44 / (download) - annotate - [select for diffs], Wed Feb 28 22:16:56 2018 UTC (6 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: 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
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

Now that log_debug() has been decyphered, replace DPRINTF() instances
with log_debug() so -v unleashes all debug output without having to
compile a custom dhclient.

Revision 1.43 / (download) - annotate - [select for diffs], Mon Jan 29 13:41:30 2018 UTC (6 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.42: +4 -4 lines
Diff to previous 1.42 (colored)

Use log_init(), log_setverbose() and log_debug() more
appropriately. Fixes '-q' logging oddities.

Prompted by phessler@ plea for '-v'-like behaviour rather
 than putting everything under DPRINTF()'s.

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jan 25 15:43:51 2018 UTC (6 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.41: +3 -7 lines
Diff to previous 1.41 (colored)

Add DPRINTF() and use it to replace log_debug() statements inside
#ifdef DEBUG/#endif blocks.

Suggestions on correct idiom (C99 vs gcc) from millert@

ok tom@

Revision 1.41 / (download) - annotate - [select for diffs], Sun Sep 17 21:20:23 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.40: +13 -10 lines
Diff to previous 1.40 (colored)

Create global 'log_procname' and set it to '<ifname>' or
'<ifname> [priv]' as appropriate for the process doing the
setting. Use it as the prefix in all log_*() output. Makes
tracking messages for an interface or a process much easier.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jul 14 16:21:03 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

Replace remaining "!var" expressions with
"<var> == 0", "!(<var> & FLAG)" with
"(<var> & FLAG) == 0", "!<func()>"
with "<func()> == 0" and "!<define>" with
"<define> == 0". And the positive cases
as well.

A few stray == NULL and != NULL as well.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Jul 10 00:47:47 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored)

Use a modern spacious idiom on all function local variable
declarations.

Revision 1.38 / (download) - annotate - [select for diffs], Sun Jul 9 19:19:58 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.37: +14 -14 lines
Diff to previous 1.37 (colored)

Be consistent. "return (e);" -> "return e;"

Revision 1.37 / (download) - annotate - [select for diffs], Sat Jul 8 00:36:10 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.36: +21 -21 lines
Diff to previous 1.36 (colored)

Always use uintNN_t instead of sometimes u_intNN_t
and sometimes uintNN_t.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jul 7 15:14:47 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

assemble_eh_header() needs only to know about hw_addr.

No more struct interface_info knowledge in packet.c

Revision 1.35 / (download) - annotate - [select for diffs], Tue Apr 18 13:59:09 2017 UTC (7 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.34: +15 -12 lines
Diff to previous 1.34 (colored)

Tweak parameters to decode_*, add a check or two, and thus gain most of the
sanity improvements reyk@ recently put into dhcrelay to ensure no more than
the captured packet is processed.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Apr 8 20:16:04 2017 UTC (7 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.33: +4 -4 lines
Diff to previous 1.33 (colored)

Reduce the overburden of signed vs unsigned comparisons by sprinkling
'int' -> 'unsigned int' (and visa versa) where obvious.

Steal a couple of 'unsigned' -> u_int32_t from reyk@'s dhcrelay
tweaks.

No intentional functional change.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Mar 8 14:19:00 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

Add comments to #endif's to allow easy differentiation between many
incoming #ifdef's.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Feb 12 13:15:50 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.31: +7 -6 lines
Diff to previous 1.31 (colored)

Switch from 'legacy' errwarn.c to standard daemon logging functions.

No objections heard. Feedback from millert@ guenther@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Aug 23 09:26:02 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Make the 'ifi' global local to dhclient.c and pass it as an argument to
functions needing it.

This is the first step to support multiple interfaces in one dhclient(8)
instance.

ok krw@

Revision 1.30 / (download) - annotate - [select for diffs], Sat Feb 6 19:30:52 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.29: +15 -2 lines
Diff to previous 1.29 (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.29 / (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.28: +26 -7 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Sat Oct 25 03:18:13 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.27: +1 -2 lines
Diff to previous 1.27 (colored)

Remove unnecessary netinet/in_systm.h include.

ok millert@

Revision 1.27 / (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.26: +4 -3 lines
Diff to previous 1.26 (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.26 / (download) - annotate - [select for diffs], Thu Apr 17 09:59:30 2014 UTC (10 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.25: +3 -7 lines
Diff to previous 1.25 (colored)

Eliminate a couple of always-NULL parameters. Eliminate some
pointless repetition of well-known info in log messages. Pass
around smaller bits of info. Make 'inaddr_any' a const struct
initialized with { INADDR_ANY }.

Tweaks and ok guenther@

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jan 20 09:16:36 2014 UTC (10 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

more %d type correctness; ok krw

Revision 1.24 / (download) - annotate - [select for diffs], Thu Dec 12 00:22:06 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.23: +8 -53 lines
Diff to previous 1.23 (colored)

Assemble outgoing packets using iovec to combine the (optional)
ethernet header, the ip header, the udp header and the packet.
Rather than manually concatenating the headers and then using iovec
to bundle in the packet. Eliminates some memcpy()s and convoluted
data copying.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Dec 11 00:31:12 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Stray memcpy() using src size.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Dec 6 23:40:48 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.21: +10 -13 lines
Diff to previous 1.21 (colored)

Having stopped pretending we handle anything but ethernet packets,
replace the 'struct hardware' abstraction layer and use 'struct
ether_addr' where hardware addresses are of interest.

ok matthew@, confirmed by reyk@ not to impact DHCP-over-IPSec support.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Dec 5 21:32:59 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

Use destination size as size of memcpy(). Use <in_addr> rather than
<in_addr>.s_addr to shorten code.

ok deraadt@ matthew@ as part of larger diff

Revision 1.20 / (download) - annotate - [select for diffs], Thu Dec 5 21:03:40 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.19: +4 -6 lines
Diff to previous 1.19 (colored)

Nuke local #define ETHER_HEADER_SIZE and use the identical value'd
ETHER_HDR_LEN from if_ether.h. dhclient change ok matthew@ as part
of larger diff.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Dec 4 19:39:50 2013 UTC (10 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

More memcpy() stylistic repairs and size checks.

Revision 1.18 / (download) - annotate - [select for diffs], Thu May 2 16:35:27 2013 UTC (11 years, 1 month ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Bunch of comment/whitespace cleanup. Eliminate some misleading or
pointless ones, make multiline comments readable, nuke '...' in
favour of '.', etc.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 24 01:26:30 2013 UTC (11 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

Follow ISC and freebsd by increasing ip_ttl on packets from 16 to
128, so people living many hops from their dhcp server can still
get leases.

Pointed out by deraadt@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Feb 3 21:04:19 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.15: +22 -23 lines
Diff to previous 1.15 (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.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jan 5 13:41:56 2013 UTC (11 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Apply same fix to UDP length check as was just committed in dhcpd.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 15 14:54:18 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.13: +1 -2 lines
Diff to previous 1.13 (colored)

Shuffle #include's to use the majority idiom everywhere - i.e. use
dhcpd.h to pull in most sys/net/netinet/etc. .h file. Eliminate
superfluous #include's.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jun 6 04:02:42 2009 UTC (14 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: 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, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.12: +5 -1 lines
Diff to previous 1.12 (colored)

Nuke debug() unless DEBUG is defined. Elminates debug output from
normal operations.

Prodded by deraadt@ a while ago.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Dec 28 01:10:46 2006 UTC (17 years, 5 months ago) by stevesk
Branch: MAIN
CVS Tags: 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
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

small knf (extra space, newline)

Revision 1.11 / (download) - annotate - [select for diffs], Tue Dec 26 21:19:52 2006 UTC (17 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.10: +4 -5 lines
Diff to previous 1.10 (colored)

Our dhclient only handles one interface. Simplify code by using the
single, global, instance of 'struct interface_info' (ifi) rather than
passing around pointers to it.

"I agree" henning@

Testing moritz@ stevesk@, ok stevesk@

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 22 03:18:14 2006 UTC (17 years, 5 months ago) by stevesk
Branch: MAIN
Changes since 1.9: +1 -6 lines
Diff to previous 1.9 (colored)

delete prototypes for functions that don't exist

Revision 1.9 / (download) - annotate - [select for diffs], Tue May 4 18:58:50 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: 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.8: +6 -8 lines
Diff to previous 1.8 (colored)

more shrink and lint fixes; henning ok

Revision 1.8 / (download) - annotate - [select for diffs], Wed Feb 25 14:22:12 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.7: +37 -25 lines
Diff to previous 1.7 (colored)

doesn't quite make sense to have a wrapper to a wrapper to the incredible
amount of ~ 20 lines of code in their own file...
and another one bites the dust

Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 24 13:36:13 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

remove dynamic port gunk

Revision 1.6 / (download) - annotate - [select for diffs], Tue Feb 24 00:34:40 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.5: +5 -39 lines
Diff to previous 1.5 (colored)

cut debug crap

Revision 1.5 / (download) - annotate - [select for diffs], Mon Feb 23 18:27:37 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.4: +3 -14 lines
Diff to previous 1.4 (colored)

no token ring

Revision 1.4 / (download) - annotate - [select for diffs], Sat Feb 7 13:26:35 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

more KNF From: Emil Mikulic <emikulic@dmr.ath.cx>
great job.
no binary change.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Feb 6 11:33:22 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.2: +164 -177 lines
Diff to previous 1.2 (colored)

more Knall & Rauch -> ANSI C, KNF and stuff that makes this a bit more
readable. no effect on the binary.
From: Emil Mikulic <emikulic@dmr.ath.cx>

Revision 1.2 / (download) - annotate - [select for diffs], Wed Feb 4 12:16:56 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

$OpenBSD$, tedu

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jan 18 01:26:20 2004 UTC (20 years, 4 months ago) by deraadt
Branch: MAIN

this is where dhclient will start surgery

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.