fix: splice
This commit is contained in:
parent
1d2b6f8c36
commit
ad21b8b1ba
|
@ -89,6 +89,7 @@
|
||||||
drvConfig = {
|
drvConfig = {
|
||||||
mkDerivation = {
|
mkDerivation = {
|
||||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||||
|
meta.mainProgram = "mdns-relay";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -115,15 +115,14 @@ fn main() -> Result<()> {
|
||||||
let socket: UdpSocket = socket.into();
|
let socket: UdpSocket = socket.into();
|
||||||
loop {
|
loop {
|
||||||
match socket.recv_from(&mut buf) {
|
match socket.recv_from(&mut buf) {
|
||||||
Ok((l, from)) => {
|
Ok((_l, from)) => {
|
||||||
let buf = &buf[0..l];
|
|
||||||
if interfaces
|
if interfaces
|
||||||
.iter()
|
.iter()
|
||||||
.any(|x| x.iface.ips.iter().any(|y| y.ip() == from.ip()))
|
.any(|x| x.iface.ips.iter().any(|y| y.ip() == from.ip()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let packet = Packet::parse(buf)?;
|
let packet = Packet::parse(&buf)?;
|
||||||
let iface = match get_iface(&from, &interfaces) {
|
let iface = match get_iface(&from, &interfaces) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
error!("Invalid packet received from {}", from);
|
error!("Invalid packet received from {}", from);
|
||||||
|
@ -152,7 +151,7 @@ fn main() -> Result<()> {
|
||||||
if out.contains(&i.iface.name) {
|
if out.contains(&i.iface.name) {
|
||||||
debug!("sending packet on {}", i.iface.name);
|
debug!("sending packet on {}", i.iface.name);
|
||||||
let sock_addr = SocketAddrV4::new(ADDR, 5353).into();
|
let sock_addr = SocketAddrV4::new(ADDR, 5353).into();
|
||||||
i.socket.send_to(buf, &sock_addr)?;
|
i.socket.send_to(&buf, &sock_addr)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue