Skip to content

Commit

Permalink
Broadcast replies if remote address is 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Dec 7, 2023
1 parent 953ce46 commit e569965
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions edge-dhcp/src/io/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,18 @@ where
self.server
.handle_request(&mut opt_buf, &self.server_options, &request)
{
let remote = if let SocketAddr::V4(socket) = remote {
if request.broadcast || *socket.ip() == Ipv4Addr::UNSPECIFIED {
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::BROADCAST, remote.port()))
} else {
remote
}
} else {
remote
};

socket
.send(
local,
if true
// TODO: Why
/*request.broadcast*/
{
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::BROADCAST, remote.port()))
} else {
remote
},
request.encode(self.buf)?,
)
.send(local, remote, request.encode(self.buf)?)
.await
.map_err(Error::Io)?;
}
Expand Down

0 comments on commit e569965

Please sign in to comment.