From c771bfbe3627c73818a45381950fc5ae73bc53b5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 29 Mar 2021 22:11:58 +0200 Subject: NS_Emulation: Use endpoint list for SNS-CONFIG payload We used to have no distinction between endpoints and NSVCs, meaning that we could not have more than one NSVC per endpoint, which in turn meant it was ok to iterate the list of NSVCs for generating the endpoint lists in the SNS-CONFIG payload. With Change-Id I05a50b966b8ce93497372ca403d40fd383dd35f7 we remove that constraint and introduce an actual local IP endpoint list. Let's use that one for SNS-CONFIG. Change-Id: Ifa91510430a017fa29592a3d5fa2a3697d29c9da --- library/NS_Emulation.ttcnpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp index 85869dae..d58dc45d 100644 --- a/library/NS_Emulation.ttcnpp +++ b/library/NS_Emulation.ttcnpp @@ -504,30 +504,25 @@ module NS_Emulation { } } - /* generate a list of v4 + v6 endpoints based on the NSVConfigurations. This is not strictly - * accurate, as we should create a list of _endpoints_, while we actually create a list of - * NSVCs. Those are only identical as long as our peer only implements one endpoint */ + /* generate a list of v4 + v6 endpoints based on the IpEndpointTable */ private function gen_sns_ip_elems(out template (omit) IP4_Elements v4_out, out template (omit) IP6_Elements v6_out) runs on NS_CT { var integer i; var IP4_Elements v4 := {}; var IP6_Elements v6 := {}; - for (i := 0; i < lengthof(g_config.nsvc); i := i + 1) { - var NSVCConfiguration nsvc_cfg := g_config.nsvc[i]; - if (not ischosen(nsvc_cfg.provider.ip)) { - continue; - } - if (nsvc_cfg.provider.ip.address_family == AF_INET) { - v4 := v4 & { valueof(ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip, - nsvc_cfg.provider.ip.local_udp_port, - nsvc_cfg.provider.ip.signalling_weight, - nsvc_cfg.provider.ip.data_weight)) }; - } else if (nsvc_cfg.provider.ip.address_family == AF_INET6) { - v6 := v6 & { valueof(ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip, - nsvc_cfg.provider.ip.local_udp_port, - nsvc_cfg.provider.ip.signalling_weight, - nsvc_cfg.provider.ip.data_weight)) }; + for (i := 0; i < lengthof(g_ip_endpoints); i := i + 1) { + var IpEndpointTableEntry ipep := g_ip_endpoints[i]; + if (ipep.address_family == AF_INET) { + v4 := v4 & { valueof(ts_SNS_IPv4(ipep.local_ip, + ipep.local_udp_port, + ipep.signalling_weight, + ipep.data_weight)) }; + } else if (ipep.address_family == AF_INET6) { + v6 := v6 & { valueof(ts_SNS_IPv6(ipep.local_ip, + ipep.local_udp_port, + ipep.signalling_weight, + ipep.data_weight)) }; } } -- cgit v1.2.3