1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

resolved: rename manager_our_packet() → manager_packet_from_local_address()

Let's be more precise in naming this function, after all this doesn#t
actually check if the packet is really ours, but just that the source IP
address is a local one. Hence name it that way.

(This is preparation to add a helper that checks if packet belongs to
local transaction later on)
This commit is contained in:
Lennart Poettering 2020-11-05 15:54:47 +01:00
parent ae49ce8761
commit 94378145e6
6 changed files with 9 additions and 6 deletions

View File

@ -1126,7 +1126,7 @@ void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p) {
return;
}
if (manager_our_packet(scope->manager, p))
if (manager_packet_from_local_address(scope->manager, p))
return;
r = dns_packet_extract(p);

View File

@ -317,8 +317,9 @@ static void dns_transaction_tentative(DnsTransaction *t, DnsPacket *p) {
assert(t);
assert(p);
assert(t->scope->protocol == DNS_PROTOCOL_LLMNR);
if (manager_our_packet(t->scope->manager, p) != 0)
if (manager_packet_from_local_address(t->scope->manager, p) != 0)
return;
(void) in_addr_to_string(p->family, &p->sender, &pretty);

View File

@ -83,7 +83,7 @@ static int on_llmnr_packet(sd_event_source *s, int fd, uint32_t revents, void *u
if (r <= 0)
return r;
if (manager_our_packet(m, p))
if (manager_packet_from_local_address(m, p))
return 0;
scope = manager_find_scope(m, p);

View File

@ -1255,10 +1255,12 @@ LinkAddress* manager_find_link_address(Manager *m, int family, const union in_ad
return NULL;
}
bool manager_our_packet(Manager *m, DnsPacket *p) {
bool manager_packet_from_local_address(Manager *m, DnsPacket *p) {
assert(m);
assert(p);
/* Let's see if this packet comes from an IP address we have on any local interface */
return !!manager_find_link_address(m, p->family, &p->sender);
}

View File

@ -165,7 +165,7 @@ LinkAddress* manager_find_link_address(Manager *m, int family, const union in_ad
void manager_refresh_rrs(Manager *m);
int manager_next_hostname(Manager *m);
bool manager_our_packet(Manager *m, DnsPacket *p);
bool manager_packet_from_local_address(Manager *m, DnsPacket *p);
DnsScope* manager_find_scope(Manager *m, DnsPacket *p);
void manager_verify_all(Manager *m);

View File

@ -254,7 +254,7 @@ static int on_mdns_packet(sd_event_source *s, int fd, uint32_t revents, void *us
if (r <= 0)
return r;
if (manager_our_packet(m, p))
if (manager_packet_from_local_address(m, p))
return 0;
scope = manager_find_scope(m, p);