summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/dhcp-network.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-14 17:23:58 +0100
committerTom Gundersen <teg@jklm.no>2014-02-15 12:14:45 +0100
commit080ab27621e979e75f6bb1a055616f3d419f7ac3 (patch)
tree24fc20580762e553e984ae10a9677c03d47852ac /src/libsystemd-dhcp/dhcp-network.c
parent818dc5e72af8a3eb772997188e2bd8ea616de844 (diff)
sd-dhcp: network - don't hardcode ports
We want to reuse these functions for the server library too.
Diffstat (limited to 'src/libsystemd-dhcp/dhcp-network.c')
-rw-r--r--src/libsystemd-dhcp/dhcp-network.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsystemd-dhcp/dhcp-network.c b/src/libsystemd-dhcp/dhcp-network.c
index b2de67e8a7..6c9d4ef999 100644
--- a/src/libsystemd-dhcp/dhcp-network.c
+++ b/src/libsystemd-dhcp/dhcp-network.c
@@ -56,13 +56,13 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
return s;
}
-int dhcp_network_bind_udp_socket(int index, be32_t client_address)
+int dhcp_network_bind_udp_socket(int index, be32_t address, uint16_t port)
{
int s;
union sockaddr_union src = {
.in.sin_family = AF_INET,
- .in.sin_port = htobe16(DHCP_PORT_CLIENT),
- .in.sin_addr.s_addr = client_address,
+ .in.sin_port = htobe16(port),
+ .in.sin_addr.s_addr = address,
};
s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
@@ -90,13 +90,13 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
return 0;
}
-int dhcp_network_send_udp_socket(int s, be32_t server_address,
+int dhcp_network_send_udp_socket(int s, be32_t address, uint16_t port,
const void *packet, size_t len)
{
union sockaddr_union dest = {
.in.sin_family = AF_INET,
- .in.sin_port = htobe16(DHCP_PORT_SERVER),
- .in.sin_addr.s_addr = server_address,
+ .in.sin_port = htobe16(port),
+ .in.sin_addr.s_addr = address,
};
if (sendto(s, packet, len, 0, &dest.sa, sizeof(dest.in)) < 0)