mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-15 04:42:06 +00:00
fix byte order of DHCP_SERVER_ID option
If miraclecat is GO, miracle-dhcp runs as server, it send out SERVER_ID option in little endian, causes non-GO peer connect to wrong IP address, so RTSP connection can't be established. In scenario like, say Android (GO) <-> miracalcast (non-GO), the DHCP service is provided by Android, in this case, the SERVER_ID is in expected byte order (big endian).
This commit is contained in:
parent
c0f49c3b9c
commit
2a3796cfe9
1 changed files with 2 additions and 2 deletions
|
@ -456,7 +456,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);
|
||||
get_be32(&dhcp_server->server_nip));
|
||||
}
|
||||
|
||||
static void add_option(gpointer key, gpointer value, gpointer user_data)
|
||||
|
@ -675,7 +675,7 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
|
|||
|
||||
server_id_option = dhcp_get_option(&packet, DHCP_SERVER_ID);
|
||||
if (server_id_option) {
|
||||
uint32_t server_nid = get_be32(server_id_option);
|
||||
uint32_t server_nid = get_unaligned((uint32_t *) server_id_option);
|
||||
|
||||
if (server_nid != dhcp_server->server_nip)
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue