File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
PcapDotNet/src/PcapDotNet.Packets/Dhcp Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ private static class Offset
7070 public const int OptionsWithMagicCookie = 240 ;
7171 }
7272
73- internal const int DHCP_MAGIC_COOKIE = 0x63825363 ;
73+ internal const uint DHCP_MAGIC_COOKIE = 0x63825363 ;
7474
7575 /// <summary>
7676 /// RFC 2131.
@@ -223,9 +223,9 @@ public bool IsDhcp
223223 {
224224 get
225225 {
226- if ( Length >= Offset . Options + 4 )
226+ if ( Length >= Offset . Options + sizeof ( uint ) )
227227 {
228- return ReadInt ( Offset . Options , Endianity . Big ) == DHCP_MAGIC_COOKIE ;
228+ return ReadUInt ( Offset . Options , Endianity . Big ) == DHCP_MAGIC_COOKIE ;
229229 }
230230 else
231231 {
@@ -284,7 +284,7 @@ internal static int GetLength(bool isDhcp, IList<DhcpOption> options)
284284
285285 if ( options != null )
286286 {
287- length += options . Sum ( p => 1 + ( ! ( p is DhcpPadOption || p is DhcpEndOption ) ? 1 : 0 ) + p . Length ) ; //Type + Len? + Option
287+ length += options . Sum ( option => sizeof ( byte ) + ( ! ( option . OptionCode == DhcpOptionCode . Pad || option . OptionCode == DhcpOptionCode . End ) ? sizeof ( byte ) : 0 ) + option . Length ) ; // Type + Len? + Option
288288 }
289289
290290 return length ;
You can’t perform that action at this time.
0 commit comments