SolidWallOfCode commented on code in PR #9767:
URL: https://github.com/apache/trafficserver/pull/9767#discussion_r1222055829


##########
iocore/net/SSLSNIConfig.cc:
##########
@@ -111,80 +113,72 @@ int
 SNIConfigParams::load_sni_config()
 {
   for (auto &item : yaml_sni.items) {
-    auto ai = sni_action_list.emplace(sni_action_list.end());
-    ai->set_glob_name(item.fqdn);
+    auto &ai = sni_action_list.emplace_back();
+    ai.set_glob_name(item.fqdn);
+    if (!item.port_ranges.empty()) {
+      auto const [min, max]{item.port_ranges[0]};
+      ai.ports = {static_cast<uint16_t>(min), static_cast<uint16_t>(max)};
+    }
     Debug("ssl", "name: %s", item.fqdn.data());
 
-    // set SNI based actions to be called in the ssl_servername_only callback
-    if (item.offer_h2.has_value()) {
-      
ai->actions.push_back(std::make_unique<ControlH2>(item.offer_h2.value()));
-    }
-    if (item.verify_client_level != 255) {
-      ai->actions.push_back(
-        std::make_unique<VerifyClient>(item.verify_client_level, 
item.verify_client_ca_file, item.verify_client_ca_dir));
-    }
-    if (item.host_sni_policy != 255) {
-      
ai->actions.push_back(std::make_unique<HostSniPolicy>(item.host_sni_policy));
-    }
-    if (item.valid_tls_version_min_in >= 0 || item.valid_tls_version_max_in >= 
0) {
-      
ai->actions.push_back(std::make_unique<TLSValidProtocols>(item.valid_tls_version_min_in,
 item.valid_tls_version_max_in));
-    } else {
-      if (!item.protocol_unset) {
-        
ai->actions.push_back(std::make_unique<TLSValidProtocols>(item.protocol_mask));
-      }
-    }
-    if (item.tunnel_destination.length() > 0) {
-      ai->actions.push_back(
-        std::make_unique<TunnelDestination>(item.tunnel_destination, 
item.tunnel_type, item.tunnel_prewarm, item.tunnel_alpn));
-    }
-    if (!item.client_sni_policy.empty()) {
-      
ai->actions.push_back(std::make_unique<OutboundSNIPolicy>(item.client_sni_policy));
-    }
-    if (item.http2_buffer_water_mark.has_value()) {
-      
ai->actions.push_back(std::make_unique<HTTP2BufferWaterMark>(item.http2_buffer_water_mark.value()));
+    item.populate_sni_actions(ai.actions);
+    if (set_next_hop_properties(item) == 1) {
+      return 1;
     }
+  }
 
-    
ai->actions.push_back(std::make_unique<ServerMaxEarlyData>(item.server_max_early_data));
+  return 0;
+}
 
-    ai->actions.push_back(std::make_unique<SNI_IpAllow>(item.ip_allow, 
item.fqdn));
+int

Review Comment:
   Why are these returning `int`? These should all return `bool` or 
`swoc::Errata`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to