瀏覽代碼

integration/xdp: use kernel-allocated port

Tamir Duberstein 1 年之前
父節點
當前提交
062ebfdc68
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      test/integration-test/src/tests/xdp.rs

+ 3 - 2
test/integration-test/src/tests/xdp.rs

@@ -84,10 +84,11 @@ fn cpumap_chain() {
 
 
     const PAYLOAD: &str = "hello cpumap";
     const PAYLOAD: &str = "hello cpumap";
 
 
-    let sock = UdpSocket::bind("127.0.0.1:1777").unwrap();
+    let sock = UdpSocket::bind("127.0.0.1:0").unwrap();
+    let addr = sock.local_addr().unwrap();
     sock.set_read_timeout(Some(Duration::from_millis(1)))
     sock.set_read_timeout(Some(Duration::from_millis(1)))
         .unwrap();
         .unwrap();
-    sock.send_to(PAYLOAD.as_bytes(), "127.0.0.1:1777").unwrap();
+    sock.send_to(PAYLOAD.as_bytes(), addr).unwrap();
 
 
     // Read back the packet to ensure it went through the entire network stack, including our two
     // Read back the packet to ensure it went through the entire network stack, including our two
     // probes.
     // probes.