summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-packet.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@users.noreply.github.com>2016-11-11 05:04:19 +0530
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-10 18:34:19 -0500
commit9faed222fc92c53b6439f52857403a522cf31bd9 (patch)
treea365479256c3b507d1d1423300a0a5bf4c0f8ac1 /src/libsystemd-network/dhcp-packet.c
parenta1ef6bd1e3e690908f886db0cb639b0015c1b704 (diff)
networkd: support setting dhcp client listen port (#4631)
Allow setting custom port for the DHCP client to listen on in networkd. [DHCP] ListenPort=6677
Diffstat (limited to 'src/libsystemd-network/dhcp-packet.c')
-rw-r--r--src/libsystemd-network/dhcp-packet.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c
index 8be774061d..40442b3636 100644
--- a/src/libsystemd-network/dhcp-packet.c
+++ b/src/libsystemd-network/dhcp-packet.c
@@ -114,7 +114,7 @@ void dhcp_packet_append_ip_headers(DHCPPacket *packet, be32_t source_addr,
packet->ip.check = dhcp_packet_checksum((uint8_t*)&packet->ip, DHCP_IP_SIZE);
}
-int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
+int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, uint16_t port) {
size_t hdrlen;
assert(packet);
@@ -160,10 +160,10 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
return -EINVAL;
}
- if (be16toh(packet->udp.dest) != DHCP_PORT_CLIENT) {
+ if (be16toh(packet->udp.dest) != port) {
log_debug("ignoring packet: to port %u, which "
"is not the DHCP client port (%u)",
- be16toh(packet->udp.dest), DHCP_PORT_CLIENT);
+ be16toh(packet->udp.dest), port);
return -EINVAL;
}