Skip to content

Commit ace5a5c

Browse files
committed
General Bugfix
Fixed missing code in DHCPv4 and DHCPv6- parsePacket-Method
1 parent 5c91fef commit ace5a5c

15 files changed

Lines changed: 56 additions & 13 deletions
0 Bytes
Binary file not shown.

DhcpDotNet/.vs/DhcpDotNet/v16/.suo

0 Bytes
Binary file not shown.

DhcpDotNet/DhcpDotNet/DHCPv6Packet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public bool parsePacket(byte[] pPayload)
5252
{
5353
try
5454
{
55-
using (MemoryStream memoryStream = new MemoryStream())
55+
using (MemoryStream memoryStream = new MemoryStream(pPayload))
5656
{
5757
using (BinaryReader binaryReader = new BinaryReader(memoryStream))
5858
{

DhcpDotNet/DhcpDotNet/DhcpDotNet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Copyright>Copyright 2020</Copyright>
99
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1010
<RepositoryUrl>https://github.com/Marschall-dev/DhcpDotNet</RepositoryUrl>
11-
<Version>2.0.3</Version>
11+
<Version>2.0.4</Version>
1212
<PackageTags>DHCP, DHCP Packet, DHCP Server, DHCP Client, Dynamic Host Configuration Protocol</PackageTags>
1313
<NeutralLanguage>en</NeutralLanguage>
1414
<PackageIcon>logo.png</PackageIcon>

DhcpDotNet/DhcpDotNet/Dhcpv4Packet.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.IO;
45
using System.Linq;
56

@@ -144,7 +145,7 @@ public bool parsePacket(byte[] pPayload)
144145
{
145146
try
146147
{
147-
using (MemoryStream memoryStream = new MemoryStream())
148+
using (MemoryStream memoryStream = new MemoryStream(pPayload))
148149
{
149150
using (BinaryReader binaryReader = new BinaryReader(memoryStream))
150151
{
@@ -160,7 +161,7 @@ public bool parsePacket(byte[] pPayload)
160161
siaddr = binaryReader.ReadBytes(4);
161162
giaddr = binaryReader.ReadBytes(4);
162163
chaddr = binaryReader.ReadBytes(Convert.ToInt32(hlen));
163-
chaddrPadding = binaryReader.ReadBytes(16 - chaddr.Length);
164+
chaddrPadding = binaryReader.ReadBytes(Convert.ToInt32(16 - chaddr.Length));
164165
sname = binaryReader.ReadBytes(64);
165166
file = binaryReader.ReadBytes(128);
166167
magicCookie = binaryReader.ReadBytes(4);
@@ -169,7 +170,10 @@ public bool parsePacket(byte[] pPayload)
169170
}
170171
return true;
171172
}
172-
catch (Exception) { }
173+
catch (Exception eX)
174+
{
175+
Debug.WriteLine("DhcpDotNet-Exception: " + eX.Message);
176+
}
173177
return false;
174178
}
175179
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>DhcpDotNet</id>
5+
<version>2.0.3</version>
6+
<authors>Marschall TM</authors>
7+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
8+
<license type="expression">MIT</license>
9+
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
10+
<icon>logo.png</icon>
11+
<projectUrl>https://github.com/Marschall-dev/DhcpDotNet</projectUrl>
12+
<description>Fully managed, cross platform (Windows, Mac, Linux) .NET library for creating DHCP packets. Supports DHCPv4 and DHCPv6.</description>
13+
<copyright>Copyright 2020</copyright>
14+
<tags>DHCP, DHCP Packet, DHCP Server, DHCP Client, Dynamic Host Configuration Protocol</tags>
15+
<repository url="https://github.com/Marschall-dev/DhcpDotNet" />
16+
<dependencies>
17+
<group targetFramework=".NETStandard2.0" />
18+
</dependencies>
19+
</metadata>
20+
<files>
21+
<file src="G:\Desktop\DhcpDotNet\DhcpDotNet\DhcpDotNet\bin\Debug\netstandard2.0\DhcpDotNet.dll" target="lib\netstandard2.0\DhcpDotNet.dll" />
22+
<file src="G:\Desktop\DhcpDotNet\DhcpDotNet\logo.png" target="logo.png" />
23+
</files>
24+
</package>
Binary file not shown.

DhcpDotNet/DhcpDotNet/obj/DhcpDotNet.csproj.nuget.dgspec.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
},
66
"projects": {
77
"G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj": {
8-
"version": "2.0.3",
8+
"version": "2.0.4",
99
"restore": {
1010
"projectUniqueName": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
1111
"projectName": "DhcpDotNet",
1212
"projectPath": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
1313
"packagesPath": "C:\\Users\\mluck\\.nuget\\packages\\",
1414
"outputPath": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\obj\\",
1515
"projectStyle": "PackageReference",
16+
"fallbackFolders": [
17+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
18+
],
1619
"configFilePaths": [
1720
"C:\\Users\\mluck\\AppData\\Roaming\\NuGet\\NuGet.Config",
1821
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
@@ -26,6 +29,7 @@
2629
},
2730
"frameworks": {
2831
"netstandard2.0": {
32+
"targetAlias": "netstandard2.0",
2933
"projectReferences": {}
3034
}
3135
},
@@ -37,6 +41,7 @@
3741
},
3842
"frameworks": {
3943
"netstandard2.0": {
44+
"targetAlias": "netstandard2.0",
4045
"dependencies": {
4146
"NETStandard.Library": {
4247
"suppressParent": "All",
@@ -55,7 +60,7 @@
5560
],
5661
"assetTargetFallback": true,
5762
"warn": true,
58-
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
63+
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.101\\RuntimeIdentifierGraph.json"
5964
}
6065
}
6166
}

DhcpDotNet/DhcpDotNet/obj/DhcpDotNet.csproj.nuget.g.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
66
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
77
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
8-
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\mluck\.nuget\packages\</NuGetPackageFolders>
8+
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\mluck\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
99
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
10-
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.7.0</NuGetToolVersion>
10+
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.8.0</NuGetToolVersion>
1111
</PropertyGroup>
1212
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
1313
<SourceRoot Include="$([MSBuild]::EnsureTrailingSlash($(NuGetPackageFolders)))" />

DhcpDotNet/DhcpDotNet/obj/project.assets.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,21 @@
180180
]
181181
},
182182
"packageFolders": {
183-
"C:\\Users\\mluck\\.nuget\\packages\\": {}
183+
"C:\\Users\\mluck\\.nuget\\packages\\": {},
184+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
184185
},
185186
"project": {
186-
"version": "2.0.3",
187+
"version": "2.0.4",
187188
"restore": {
188189
"projectUniqueName": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
189190
"projectName": "DhcpDotNet",
190191
"projectPath": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
191192
"packagesPath": "C:\\Users\\mluck\\.nuget\\packages\\",
192193
"outputPath": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\obj\\",
193194
"projectStyle": "PackageReference",
195+
"fallbackFolders": [
196+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
197+
],
194198
"configFilePaths": [
195199
"C:\\Users\\mluck\\AppData\\Roaming\\NuGet\\NuGet.Config",
196200
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
@@ -204,6 +208,7 @@
204208
},
205209
"frameworks": {
206210
"netstandard2.0": {
211+
"targetAlias": "netstandard2.0",
207212
"projectReferences": {}
208213
}
209214
},
@@ -215,6 +220,7 @@
215220
},
216221
"frameworks": {
217222
"netstandard2.0": {
223+
"targetAlias": "netstandard2.0",
218224
"dependencies": {
219225
"NETStandard.Library": {
220226
"suppressParent": "All",
@@ -233,7 +239,7 @@
233239
],
234240
"assetTargetFallback": true,
235241
"warn": true,
236-
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
242+
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.101\\RuntimeIdentifierGraph.json"
237243
}
238244
}
239245
}

0 commit comments

Comments
 (0)