-1

I have the following client IPMI ping program:

pub fn ping(host: &String) -> Result<(), String> {
    let socket = UdpSocket::bind("0.0.0.0:0").expect("Unable to bind to host");

    let mut udp_payload: Vec<u8> = vec![];
    // WRITE RMCP header
    // WRITE ASF Ping header

    let mut retry_count = 3;

    while retry_count > 0 {
        match socket.send_to(udp_payload.as_slice(), host) {
            Ok(_) => trace!("Successfully sent ping packet"),
            Err(_) => {
                trace!("Unable to send ping packet retrying");
                retry_count -= 1;
                continue;
            }
        }

        trace!("Sent ping pkt");

        let mut buffer = [0u8; 1500];
        match socket.recv_from(&mut buffer) {
            Ok((amt, source)) => {
                trace!("Got {} a pong response from {}", amt, source);
                // Verify RMCP and ASF Pong headers
                return Ok(());
            }
            Err(err) => {
                trace!("Did not receive a Pong response, so retrying {}", err);
                retry_count = retry_count - 1;
                continue;
            }
        }
    }
    Err(format!("IPMI ping failed"))
}

I took a packet capture while running the above function. I see the ping packet being sent and a pong response being received from the server, but the recv_from function never returns.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
vishpat
  • 133
  • 1
  • 7

2 Answers2

0

I was running the above program on Mac along with Proxifier that was messing up the UDP traffic. Once I stopped running proxifier my program start working without any issues.

vishpat
  • 133
  • 1
  • 7
0

I don't know....

But I would guess that "Proxifier" changes the firewall settings, and those changes make disrupt your UDP. You might want to read up on iptables, and its replacement nftables.

John b
  • 1,338
  • 8
  • 16