netutils/dhcpd: specify port number when binding the socket
authorJin-Seong Kim <jseong82.kim@samsung.com>
Mon, 27 Mar 2017 07:59:32 +0000 (16:59 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:02 +0000 (12:02 +0900)
This commit is to patch for specifying port number of dhcp server when
binding the socket. If there is no port number specified, DHCP packets
have wrong port number and this may cause interoperability problems
during DHCP handshaking with various other platforms.

Change-Id: Ife196fd1a524b2f3b4a0e1157ca28910d47ee8fd
Signed-off-by: Jin-Seong Kim <jseong82.kim@samsung.com>
apps/netutils/dhcpd/dhcpd.c

index b062dc5..7fcfbe8 100755 (executable)
@@ -858,7 +858,7 @@ static inline int dhcpd_openresponder(void)
        /* Bind the socket to a local port. */
 
        addr.sin_family = AF_INET;
-       addr.sin_port = 0;
+       addr.sin_port = HTONS(DHCP_SERVER_PORT);
        addr.sin_addr.s_addr = g_state.ds_serverip;
 
        ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));