Cosmetic cleanup of create_udp_listen_socket() to eliminate invariant
arguments.
This commit is contained in:
		@@ -102,12 +102,13 @@ static int create_udp_socket(uint32_t ip, uint16_t port, char *iface)
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns fd of new listen socket bound to @ip:@port on interface @inf
 | 
			
		||||
// Returns fd of new listen socket bound to 0.0.0.0:@68 on interface @inf
 | 
			
		||||
// on success, or -1 on failure.
 | 
			
		||||
static int create_udp_listen_socket(struct client_state_t *cs, unsigned int ip, int port, char *inf)
 | 
			
		||||
static int create_udp_listen_socket(struct client_state_t *cs, char *inf)
 | 
			
		||||
{
 | 
			
		||||
    log_line("Opening listen socket on 0x%08x:%d %s", ip, port, inf);
 | 
			
		||||
    int fd = create_udp_socket(ip, port, inf);
 | 
			
		||||
    log_line("Opening listen socket on 0x%08x:%d %s", INADDR_ANY,
 | 
			
		||||
             DHCP_CLIENT_PORT, inf);
 | 
			
		||||
    int fd = create_udp_socket(INADDR_ANY, DHCP_CLIENT_PORT, inf);
 | 
			
		||||
    if (fd == -1)
 | 
			
		||||
        return -1;
 | 
			
		||||
    int opt = 1;
 | 
			
		||||
@@ -466,8 +467,7 @@ static void change_listen_mode(struct client_state_t *cs, int new_mode)
 | 
			
		||||
    }
 | 
			
		||||
    cs->listenFd = new_mode == LM_RAW ?
 | 
			
		||||
        create_raw_listen_socket(cs, client_config.ifindex) :
 | 
			
		||||
        create_udp_listen_socket(cs, INADDR_ANY, DHCP_CLIENT_PORT,
 | 
			
		||||
                                 client_config.interface);
 | 
			
		||||
        create_udp_listen_socket(cs, client_config.interface);
 | 
			
		||||
    if (cs->listenFd < 0) {
 | 
			
		||||
        log_error("FATAL: couldn't listen on socket: %s.", strerror(errno));
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user