summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-10 15:28:09 -0400
committerDaniel Mack <daniel@zonque.org>2015-07-13 11:28:29 -0400
commit22a37591ede1e9d5f325d6f10495cc91b40b775f (patch)
treeb104fe9ca3a35d17acdcffc7444aadcdc1d87606 /src
parent5f402ae84bbc08fe8de5682e371b3f66c387da52 (diff)
resolved: use a #define for LLMNR port
De-duplicate some magic numbers.
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-scope.c2
-rw-r--r--src/resolve/resolved-dns-transaction.c3
-rw-r--r--src/resolve/resolved-llmnr.c8
-rw-r--r--src/resolve/resolved-llmnr.h2
4 files changed, 9 insertions, 6 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index cc7e268529..596181fa4c 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -181,7 +181,7 @@ int dns_scope_emit(DnsScope *s, DnsPacket *p) {
return -EBUSY;
family = s->family;
- port = 5355;
+ port = LLMNR_PORT;
if (family == AF_INET) {
addr.in = LLMNR_MULTICAST_IPV4_ADDRESS;
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index 214938986d..21247e8a0b 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -21,6 +21,7 @@
#include "af-list.h"
+#include "resolved-llmnr.h"
#include "resolved-dns-transaction.h"
#include "random-util.h"
@@ -264,7 +265,7 @@ static int dns_transaction_open_tcp(DnsTransaction *t) {
if (r == 0)
return -EINVAL;
- fd = dns_scope_tcp_socket(t->scope, family, &address, 5355);
+ fd = dns_scope_tcp_socket(t->scope, family, &address, LLMNR_PORT);
}
} else
return -EAFNOSUPPORT;
diff --git a/src/resolve/resolved-llmnr.c b/src/resolve/resolved-llmnr.c
index ee9a416372..8afaf8db6e 100644
--- a/src/resolve/resolved-llmnr.c
+++ b/src/resolve/resolved-llmnr.c
@@ -124,7 +124,7 @@ static int on_llmnr_packet(sd_event_source *s, int fd, uint32_t revents, void *u
int manager_llmnr_ipv4_udp_fd(Manager *m) {
union sockaddr_union sa = {
.in.sin_family = AF_INET,
- .in.sin_port = htobe16(5355),
+ .in.sin_port = htobe16(LLMNR_PORT),
};
static const int one = 1, pmtu = IP_PMTUDISC_DONT, ttl = 255;
int r;
@@ -202,7 +202,7 @@ fail:
int manager_llmnr_ipv6_udp_fd(Manager *m) {
union sockaddr_union sa = {
.in6.sin6_family = AF_INET6,
- .in6.sin6_port = htobe16(5355),
+ .in6.sin6_port = htobe16(LLMNR_PORT),
};
static const int one = 1, ttl = 255;
int r;
@@ -330,7 +330,7 @@ static int on_llmnr_stream(sd_event_source *s, int fd, uint32_t revents, void *u
int manager_llmnr_ipv4_tcp_fd(Manager *m) {
union sockaddr_union sa = {
.in.sin_family = AF_INET,
- .in.sin_port = htobe16(5355),
+ .in.sin_port = htobe16(LLMNR_PORT),
};
static const int one = 1, pmtu = IP_PMTUDISC_DONT;
int r;
@@ -402,7 +402,7 @@ fail:
int manager_llmnr_ipv6_tcp_fd(Manager *m) {
union sockaddr_union sa = {
.in6.sin6_family = AF_INET6,
- .in6.sin6_port = htobe16(5355),
+ .in6.sin6_port = htobe16(LLMNR_PORT),
};
static const int one = 1;
int r;
diff --git a/src/resolve/resolved-llmnr.h b/src/resolve/resolved-llmnr.h
index 640644000a..d489d481e8 100644
--- a/src/resolve/resolved-llmnr.h
+++ b/src/resolve/resolved-llmnr.h
@@ -23,6 +23,8 @@
#include "resolved-manager.h"
+#define LLMNR_PORT 5355
+
int manager_llmnr_ipv4_udp_fd(Manager *m);
int manager_llmnr_ipv6_udp_fd(Manager *m);
int manager_llmnr_ipv4_tcp_fd(Manager *m);