@@ -237,40 +237,14 @@ func allowedRouteKindsForProtocol(protocol gwapiv1.ProtocolType, tlsMode *gwapiv
237237 }
238238}
239239
240- // validateProtocolRules validates protocol-specific constraints (hostname, TLS requirements).
241- // Returns true if all constraints are satisfied, false otherwise.
242- func validateProtocolRules (listener * ListenerContext ) bool {
243- switch listener .Protocol {
244- case gwapiv1 .HTTPProtocolType , gwapiv1 .HTTPSProtocolType , gwapiv1 .TLSProtocolType ,
245- gwapiv1 .TCPProtocolType , gwapiv1 .UDPProtocolType :
246- // All supported protocols pass basic validation here.
247- // Protocol-specific constraints (TLS, hostname) are validated in
248- // validateTLSConfiguration and validateHostName respectively,
249- // where they can set proper conditions.
250- return true
251-
252- default :
253- // Unsupported protocol handled separately
254- return false
255- }
256- }
257-
258240func (t * Translator ) validateListenerSpec (listener * ListenerContext , resources * resource.Resources ) bool {
259241 // Validate listener spec directly without relying on conditions.
260242 // Start with valid assumption and invalidate on failures.
261-
262243 // Phase 1: Validate fundamental rules
263244 specValid := t .validateAllowedNamespaces (listener )
264- if ! validateProtocolRules (listener ) {
265- specValid = false
266- }
267245
268246 // Phase 2: Validate allowed routes based on protocol
269- if listener .Protocol == gwapiv1 .HTTPProtocolType ||
270- listener .Protocol == gwapiv1 .HTTPSProtocolType ||
271- listener .Protocol == gwapiv1 .TCPProtocolType ||
272- listener .Protocol == gwapiv1 .UDPProtocolType ||
273- listener .Protocol == gwapiv1 .TLSProtocolType {
247+ if isSupportedListenerProtocol (listener .Protocol ) {
274248 var tlsMode * gwapiv1.TLSModeType
275249 if listener .TLS != nil {
276250 tlsMode = listener .TLS .Mode
0 commit comments