Skip to content

Commit 24f37ce

Browse files
committed
Added new dhcp server version, added asciinema
1 parent 3546811 commit 24f37ce

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Program.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ static void Request(DHCPRequest dhcpRequest, IPAddress targetIp)
8181
var replyOptions = new DHCPReplyOptions();
8282
replyOptions.SubnetMask = IPAddress.Parse("255.255.255.0");
8383

84-
if (type == DHCPMsgType.DHCPDISCOVER)
84+
if (type == DHCPMsgType.DHCPDISCOVER){
85+
Console.WriteLine($"Received discovery, sending offer!");
8586
dhcpRequest.SendDHCPReply(DHCPMsgType.DHCPOFFER, targetIp, replyOptions);
86-
if (type == DHCPMsgType.DHCPREQUEST)
87+
}else if (type == DHCPMsgType.DHCPREQUEST){
88+
Console.WriteLine($"Received request, sending ack!");
8789
dhcpRequest.SendDHCPReply(DHCPMsgType.DHCPACK, targetIp, replyOptions);
90+
} else {
91+
Console.WriteLine($"Received unknown DHCP type {type}");
92+
}
8893
}
8994
catch (Exception ex)
9095
{

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# dhcpshot
22

3+
[![asciicast](https://asciinema.org/a/OyMydvQOw3imDCD9OLiyiPlUB.svg)](https://asciinema.org/a/OyMydvQOw3imDCD9OLiyiPlUB)
4+
35
Use [DotNetProjects.DhcpServer](https://www.nuget.org/packages/DotNetProjects.DhcpServer/) library to quickly create a predefined DHCP Server answering with a fixed IP to request coming from the interface specified by the user. E.g.: you connect your RPI in DHCP mode directly to your laptop's ethernet interface.
46

57
## Publish

dhcpshot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="DotNetProjects.DhcpServer" Version="1.0.15" />
9+
<PackageReference Include="DotNetProjects.DhcpServer" Version="2.0.19" />
1010
<PackageReference Include="System.CommandLine.Experimental" Version="0.3.0-alpha.19573.2" />
1111
</ItemGroup>
1212

0 commit comments

Comments
 (0)