Increase NMRP timeout to 1s
This commit is contained in:
		
							parent
							
								
									0503ae2788
								
							
						
					
					
						commit
						25cda736e6
					
				
					 2 changed files with 9 additions and 5 deletions
				
			
		
							
								
								
									
										2
									
								
								main.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								main.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -131,7 +131,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	int c, val, max;
 | 
			
		||||
	bool list = false, have_dest_mac = false;
 | 
			
		||||
	struct nmrpd_args args = {
 | 
			
		||||
		.rx_timeout = 200,
 | 
			
		||||
		.rx_timeout = 1000,
 | 
			
		||||
		.ul_timeout = 5 * 60,
 | 
			
		||||
		.tftpcmd = NULL,
 | 
			
		||||
		.file_local = NULL,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								nmrp.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								nmrp.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -229,7 +229,7 @@ static void msg_mkconfack(struct nmrp_msg *msg, uint32_t ipaddr, uint32_t ipmask
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
#ifdef NMRPFLASH_FUZZ
 | 
			
		||||
#define NMRP_INITIAL_TIMEOUT 0
 | 
			
		||||
#define NMRP_ADVERTISE_TIMEOUT 0
 | 
			
		||||
#define ethsock_create(a, b) ((struct ethsock*)1)
 | 
			
		||||
#define ethsock_get_hwaddr(a) ethsock_get_hwaddr_fake(a)
 | 
			
		||||
#define ethsock_recv(sock, buf, len) read(STDIN_FILENO, buf, len)
 | 
			
		||||
| 
						 | 
				
			
			@ -249,7 +249,7 @@ static uint8_t *ethsock_get_hwaddr_fake(struct ethsock* sock)
 | 
			
		|||
	return hwaddr;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
#define NMRP_INITIAL_TIMEOUT 60
 | 
			
		||||
#define NMRP_ADVERTISE_TIMEOUT 60
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static int pkt_send(struct ethsock *sock, struct nmrp_pkt *pkt)
 | 
			
		||||
| 
						 | 
				
			
			@ -465,7 +465,7 @@ int nmrp_do(struct nmrpd_args *args)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ethsock_set_timeout(sock, args->rx_timeout)) {
 | 
			
		||||
	if (ethsock_set_timeout(sock, 200)) {
 | 
			
		||||
		goto out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -483,7 +483,7 @@ int nmrp_do(struct nmrpd_args *args)
 | 
			
		|||
	i = 0;
 | 
			
		||||
	upload_ok = 0;
 | 
			
		||||
	fake = 0;
 | 
			
		||||
	timeout = args->blind ? 10 : NMRP_INITIAL_TIMEOUT;
 | 
			
		||||
	timeout = args->blind ? 10 : NMRP_ADVERTISE_TIMEOUT;
 | 
			
		||||
	beg = time_monotonic();
 | 
			
		||||
 | 
			
		||||
	while (!g_interrupted) {
 | 
			
		||||
| 
						 | 
				
			
			@ -535,6 +535,10 @@ int nmrp_do(struct nmrpd_args *args)
 | 
			
		|||
		goto out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ethsock_set_timeout(sock, args->rx_timeout)) {
 | 
			
		||||
		goto out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	expect = NMRP_C_CONF_REQ;
 | 
			
		||||
	ulreqs = 0;
 | 
			
		||||
	ka_reqs = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue