Skip to content
Extraits de code Groupes Projets
Valider d45be55a rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Support for DNS subdomains

parent 8844c047
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Subproject commit 9f79c30e33e8e2625c274c90482fddf259685b76
Subproject commit 5cf2ab501e6fba18273a5dd4e337b1416bf88bc9
......@@ -215,6 +215,7 @@ uint32_t callback_{{nfqueue_name}}(int pkt_id, int pkt_len, uint8_t *payload, vo
{% if "domain_name" in nfq_match["template"] %}
{% set domain_name = nfq_match["match"] %}
domain_name = "{{domain_name}}";
subdomain = "{{domain_name.split('.', 1)[1]}}";
ip_list = dns_get_ip_from_name(dns_message.answers, dns_message.header.ancount, domain_name);
{% endif %}
{% endif %}
......@@ -225,7 +226,7 @@ uint32_t callback_{{nfqueue_name}}(int pkt_id, int pkt_len, uint8_t *payload, vo
{% if is_dns_response.value %}
if (ip_list.ip_count > 0) {
// Add IP addresses to DNS map
dns_map_add(dns_map, domain_name, ip_list);
dns_map_add(dns_map, subdomain, ip_list);
}
{% endif %}
......
......@@ -115,10 +115,11 @@ int main(int argc, char *argv[]) {
ret = dns_receive_response(sockfd, &server_addr, &dns_response);
if (ret == 0) {
ip_list = dns_get_ip_from_name(dns_response.answers, dns_response.header.ancount, "{{name}}");
dns_map_add(dns_map, "{{name}}", ip_list);
{% set subdomain = name.split(".", 1)[1] %}
dns_map_add(dns_map, "{{subdomain}}", ip_list);
#ifdef DEBUG
// Check DNS map has been correctly updated
dns_entry = dns_map_get(dns_map, "{{name}}");
dns_entry = dns_map_get(dns_map, "{{subdomain}}");
dns_entry_print(dns_entry);
#endif /* DEBUG */
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter