File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -387,7 +387,16 @@ async fn accept_task(
387
387
}
388
388
} ;
389
389
390
+ // Get the right source address in case an unsepecified IP (i.e. 0.0.0.0 or [::]) is used
391
+ let src_addr = match quic_conn. local_ip( ) {
392
+ Some ( ip) => SocketAddr :: new( ip, src_addr. port( ) ) ,
393
+ None => {
394
+ tracing:: debug!( "Can not accept QUIC connection: empty local IP" ) ;
395
+ continue ;
396
+ }
397
+ } ;
390
398
let dst_addr = quic_conn. remote_address( ) ;
399
+
391
400
tracing:: debug!( "Accepted QUIC connection on {:?}: {:?}" , src_addr, dst_addr) ;
392
401
// Create the new link object
393
402
let link = Arc :: new( LinkUnicastQuic :: new(
Original file line number Diff line number Diff line change @@ -409,6 +409,15 @@ async fn accept_task(
409
409
res = accept( & socket) => {
410
410
match res {
411
411
Ok ( ( stream, dst_addr) ) => {
412
+ // Get the right source address in case an unsepecified IP (i.e. 0.0.0.0 or [::]) is used
413
+ let src_addr = match stream. local_addr( ) {
414
+ Ok ( sa) => sa,
415
+ Err ( e) => {
416
+ tracing:: debug!( "Can not accept TCP connection: {}" , e) ;
417
+ continue ;
418
+ }
419
+ } ;
420
+
412
421
tracing:: debug!( "Accepted TCP connection on {:?}: {:?}" , src_addr, dst_addr) ;
413
422
// Create the new link object
414
423
let link = Arc :: new( LinkUnicastTcp :: new( stream, src_addr, dst_addr) ) ;
Original file line number Diff line number Diff line change @@ -372,6 +372,15 @@ async fn accept_task(
372
372
res = accept( & socket) => {
373
373
match res {
374
374
Ok ( ( tcp_stream, dst_addr) ) => {
375
+ // Get the right source address in case an unsepecified IP (i.e. 0.0.0.0 or [::]) is used
376
+ let src_addr = match tcp_stream. local_addr( ) {
377
+ Ok ( sa) => sa,
378
+ Err ( e) => {
379
+ tracing:: debug!( "Can not accept TLS connection: {}" , e) ;
380
+ continue ;
381
+ }
382
+ } ;
383
+
375
384
// Accept the TLS connection
376
385
let tls_stream = match acceptor. accept( tcp_stream) . await {
377
386
Ok ( stream) => TlsStream :: Server ( stream) ,
@@ -382,6 +391,8 @@ async fn accept_task(
382
391
}
383
392
} ;
384
393
394
+
395
+
385
396
tracing:: debug!( "Accepted TLS connection on {:?}: {:?}" , src_addr, dst_addr) ;
386
397
// Create the new link object
387
398
let link = Arc :: new( LinkUnicastTls :: new( tls_stream, src_addr, dst_addr) ) ;
Original file line number Diff line number Diff line change @@ -498,6 +498,10 @@ async fn accept_read_task(
498
498
499
499
tracing:: trace!( "Ready to accept UDP connections on: {:?}" , src_addr) ;
500
500
501
+ if src_addr. ip ( ) . is_unspecified ( ) {
502
+ tracing:: warn!( "Interceptors (e.g. Access Control, Downsampling) are not guaranteed to work on UDP when listening on 0.0.0.0 or [::]. Their usage is discouraged. See https://github.com/eclipse-zenoh/zenoh/issues/1126." ) ;
503
+ }
504
+
501
505
loop {
502
506
// Buffers for deserialization
503
507
let mut buff = zenoh_buffers:: vec:: uninit ( UDP_MAX_MTU as usize ) ;
Original file line number Diff line number Diff line change @@ -498,6 +498,15 @@ async fn accept_task(
498
498
_ = token. cancelled( ) => break ,
499
499
} ;
500
500
501
+ // Get the right source address in case an unsepecified IP (i.e. 0.0.0.0 or [::]) is used
502
+ let src_addr = match stream. local_addr ( ) {
503
+ Ok ( sa) => sa,
504
+ Err ( e) => {
505
+ tracing:: debug!( "Can not accept TCP connection: {}" , e) ;
506
+ continue ;
507
+ }
508
+ } ;
509
+
501
510
tracing:: debug!(
502
511
"Accepted TCP (WebSocket) connection on {:?}: {:?}" ,
503
512
src_addr,
You can’t perform that action at this time.
0 commit comments