The DHCP server id option was sent using host byte order instead of
network byte order. If the client uses the value when sending data
to the server, then the DHCP packet will contain IP address in
wrong byte order.
This issue was noticed with P2P connections where we do not set
the gateway address in DHCP messages so some P2P clients sent data
to wrong server as the our server address was incorrect.
---
gdhcp/server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdhcp/server.c b/gdhcp/server.c
index 8561dd3..97c16c2 100644
--- a/gdhcp/server.c
+++ b/gdhcp/server.c
@@ -56,7 +56,7 @@ struct _GDHCPServer {
char *interface;
uint32_t start_ip;
uint32_t end_ip;
- uint32_t server_nip;
+ uint32_t server_nip; /* our address in network byte order */
uint32_t lease_seconds;
int listener_sockfd;
guint listener_watch;
@@ -454,7 +454,7 @@ static void init_packet(GDHCPServer *dhcp_server, struct
dhcp_packet *packet,
packet->gateway_nip = client_packet->gateway_nip;
packet->ciaddr = client_packet->ciaddr;
dhcp_add_option_uint32(packet, DHCP_SERVER_ID,
- dhcp_server->server_nip);
+ ntohl(dhcp_server->server_nip));
}
static void add_option(gpointer key, gpointer value, gpointer user_data)
--
1.8.3.1
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman