comparison netio.c @ 1563:1cbb7b3d6703

Merge fuzzing branch
author Matt Johnston <matt@ucc.asn.au>
date Wed, 28 Feb 2018 22:12:05 +0800
parents 2f64cb3d3007
children 399d8eb961b5
comparison
equal deleted inserted replaced
1560:f5026f7486de 1563:1cbb7b3d6703
243 c->cb(DROPBEAR_FAILURE, -1, c->cb_data, c->errstring); 243 c->cb(DROPBEAR_FAILURE, -1, c->cb_data, c->errstring);
244 remove_connect(c, iter); 244 remove_connect(c, iter);
245 } 245 }
246 iter = next_iter; 246 iter = next_iter;
247 } 247 }
248 TRACE(("leave set_connect_fds"))
248 } 249 }
249 250
250 void handle_connect_fds(const fd_set *writefd) { 251 void handle_connect_fds(const fd_set *writefd) {
251 m_list_elem *iter; 252 m_list_elem *iter;
252 TRACE(("enter handle_connect_fds")) 253 TRACE(("enter handle_connect_fds"))
358 #endif 359 #endif
359 #ifdef HAVE_LINUX_PKT_SCHED_H 360 #ifdef HAVE_LINUX_PKT_SCHED_H
360 int so_prio_val = 0; 361 int so_prio_val = 0;
361 #endif 362 #endif
362 363
364 #if DROPBEAR_FUZZ
365 if (fuzz.fuzzing) {
366 TRACE(("fuzzing skips set_sock_prio"))
367 return;
368 }
369 #endif
363 370
364 /* Don't log ENOTSOCK errors so that this can harmlessly be called 371 /* Don't log ENOTSOCK errors so that this can harmlessly be called
365 * on a client '-J' proxy pipe */ 372 * on a client '-J' proxy pipe */
366 373
367 /* set the TOS bit for either ipv4 or ipv6 */ 374 /* set the TOS bit for either ipv4 or ipv6 */
582 void get_socket_address(int fd, char **local_host, char **local_port, 589 void get_socket_address(int fd, char **local_host, char **local_port,
583 char **remote_host, char **remote_port, int host_lookup) 590 char **remote_host, char **remote_port, int host_lookup)
584 { 591 {
585 struct sockaddr_storage addr; 592 struct sockaddr_storage addr;
586 socklen_t addrlen; 593 socklen_t addrlen;
594
595 #if DROPBEAR_FUZZ
596 if (fuzz.fuzzing) {
597 fuzz_get_socket_address(fd, local_host, local_port, remote_host, remote_port, host_lookup);
598 return;
599 }
600 #endif
587 601
588 if (local_host || local_port) { 602 if (local_host || local_port) {
589 addrlen = sizeof(addr); 603 addrlen = sizeof(addr);
590 if (getsockname(fd, (struct sockaddr*)&addr, &addrlen) < 0) { 604 if (getsockname(fd, (struct sockaddr*)&addr, &addrlen) < 0) {
591 dropbear_exit("Failed socket address: %s", strerror(errno)); 605 dropbear_exit("Failed socket address: %s", strerror(errno));