@@ -475,8 +475,8 @@ impl OutboundConnection {
475475 // bytes without trying to interpret it.
476476 //
477477 // NOTE: when connecting through an E/W gateway, regardless of whether there is
478- // a waypoint or not, we always use service hostname and the service port. It's
479- // somewhat different from how regular HBONE works, so I'm calling it out here .
478+ // a waypoint or not, we always use service hostname and the service port.
479+ // This is also the case for service-addressed waypoint traffic (see build_request) .
480480 async fn build_request_through_gateway (
481481 & self ,
482482 source : Arc < Workload > ,
@@ -578,7 +578,10 @@ impl OutboundConnection {
578578 return Ok ( Request {
579579 protocol : OutboundProtocol :: HBONE ,
580580 source : source_workload,
581- hbone_target_destination : Some ( HboneAddress :: SocketAddr ( target) ) ,
581+ hbone_target_destination : Some ( HboneAddress :: SvcHostname (
582+ target_service. hostname . clone ( ) ,
583+ target. port ( ) ,
584+ ) ) ,
582585 actual_destination_workload : Some ( waypoint. workload ) ,
583586 intended_destination_service : Some ( ServiceDescription :: from ( & * target_service) ) ,
584587 actual_destination,
@@ -1515,6 +1518,7 @@ mod tests {
15151518 "127.0.0.1" ,
15161519 "127.0.0.3:80" ,
15171520 XdsAddressType :: Service ( XdsService {
1521+ hostname : "example.com" . to_string ( ) ,
15181522 addresses : vec ! [ XdsNetworkAddress {
15191523 network: "" . to_string( ) ,
15201524 address: vec![ 127 , 0 , 0 , 3 ] ,
@@ -1534,10 +1538,10 @@ mod tests {
15341538 } ) ,
15351539 ..Default :: default ( )
15361540 } ) ,
1537- // Should use the waypoint
1541+ // Should use the waypoint with service hostname as authority
15381542 Some ( ExpectedRequest {
15391543 protocol : OutboundProtocol :: HBONE ,
1540- hbone_destination : "127.0.0.3 :80" ,
1544+ hbone_destination : "example.com :80" ,
15411545 destination : "127.0.0.10:15008" ,
15421546 } ) ,
15431547 )
@@ -1912,7 +1916,7 @@ mod tests {
19121916 Some ( ExpectedRequest {
19131917 protocol : OutboundProtocol :: HBONE ,
19141918 destination : "127.0.0.10:15008" ,
1915- hbone_destination : "1.2.3.4 :80" ,
1919+ hbone_destination : "example.com :80" ,
19161920 } ) ,
19171921 )
19181922 . await ;
0 commit comments