Skip to content

Commit c105005

Browse files
authored
xds: NACK missing route specifier server side (#4925)
* xds: NACK missing route specifier server side
1 parent 670c133 commit c105005

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

xds/internal/xdsclient/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ type ListenerUpdate struct {
206206
// RouteConfigName is the route configuration name corresponding to the
207207
// target which is being watched through LDS.
208208
//
209-
// Only one of RouteConfigName and InlineRouteConfig is set.
209+
// Exactly one of RouteConfigName and InlineRouteConfig is set.
210210
RouteConfigName string
211211
// InlineRouteConfig is the inline route configuration (RDS response)
212212
// returned inside LDS.
213213
//
214-
// Only one of RouteConfigName and InlineRouteConfig is set.
214+
// Exactly one of RouteConfigName and InlineRouteConfig is set.
215215
InlineRouteConfig *RouteConfigUpdate
216216

217217
// MaxStreamDuration contains the HTTP connection manager's

xds/internal/xdsclient/filter_chain.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,7 @@ func processNetworkFilters(filters []*v3listenerpb.Filter) (*FilterChain, error)
637637
}
638638
filterChain.InlineRouteConfig = &routeU
639639
case nil:
640-
// No-op, as no route specifier is a valid configuration on
641-
// the server side.
640+
return nil, fmt.Errorf("no RouteSpecifier: %+v", hcm)
642641
default:
643642
return nil, fmt.Errorf("unsupported type %T for RouteSpecifier", hcm.RouteSpecifier)
644643
}

xds/internal/xdsclient/filter_chain_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,40 @@ func TestNewFilterChainImpl_Failure_BadRouteUpdate(t *testing.T) {
770770
lis *v3listenerpb.Listener
771771
wantErr string
772772
}{
773+
{
774+
name: "missing-route-specifier",
775+
lis: &v3listenerpb.Listener{
776+
FilterChains: []*v3listenerpb.FilterChain{
777+
{
778+
Name: "filter-chain-1",
779+
Filters: []*v3listenerpb.Filter{
780+
{
781+
Name: "hcm",
782+
ConfigType: &v3listenerpb.Filter_TypedConfig{
783+
784+
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
785+
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
786+
}),
787+
},
788+
},
789+
},
790+
},
791+
},
792+
DefaultFilterChain: &v3listenerpb.FilterChain{
793+
Filters: []*v3listenerpb.Filter{
794+
{
795+
Name: "hcm",
796+
ConfigType: &v3listenerpb.Filter_TypedConfig{
797+
TypedConfig: testutils.MarshalAny(&v3httppb.HttpConnectionManager{
798+
HttpFilters: []*v3httppb.HttpFilter{emptyRouterFilter},
799+
}),
800+
},
801+
},
802+
},
803+
},
804+
},
805+
wantErr: "no RouteSpecifier",
806+
},
773807
{
774808
name: "not-ads",
775809
lis: &v3listenerpb.Listener{

0 commit comments

Comments
 (0)