From: Michael Tremer Date: Thu, 12 Nov 2020 20:09:37 +0000 (+0000) Subject: networks: Copy all attributes when splitting networks X-Git-Tag: 0.9.5~74 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=594ca328c6e124d0f1eb543e9c8d9bbfe8a7b628 networks: Copy all attributes when splitting networks Signed-off-by: Michael Tremer --- diff --git a/src/network.c b/src/network.c index 751e8e5..d67f116 100644 --- a/src/network.c +++ b/src/network.c @@ -550,6 +550,20 @@ LOC_EXPORT struct loc_network_list* loc_network_subnets(struct loc_network* netw if (r) goto ERROR; + // Copy country code + const char* country_code = loc_network_get_country_code(network); + if (country_code) { + loc_network_set_country_code(subnet1, country_code); + loc_network_set_country_code(subnet2, country_code); + } + + // Copy ASN + uint32_t asn = loc_network_get_asn(network); + if (asn) { + loc_network_set_asn(subnet1, asn); + loc_network_set_asn(subnet2, asn); + } + loc_network_unref(subnet1); loc_network_unref(subnet2);