X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fraw_socket_device.c;h=1c455e6a748412b705ae748fef05ca7b8b251354;hb=28be4baae016a5a771d0d9ec6e97ef38a4fc9e46;hp=4dd18e2b2933bf87eb7935b83c3b0f5e096dc24a;hpb=2c6b2d70e6640f39563ad7bb0aa0ba87f883848c;p=tinc diff --git a/src/raw_socket_device.c b/src/raw_socket_device.c index 4dd18e2b..1c455e6a 100644 --- a/src/raw_socket_device.c +++ b/src/raw_socket_device.c @@ -34,14 +34,14 @@ static const char *device_info = "raw_socket"; static bool setup_device(void) { - struct ifreq ifr; - struct sockaddr_ll sa; + struct ifreq ifr = {0}; + struct sockaddr_ll sa = {0}; - if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) { + if(!get_config_string(lookup_config(&config_tree, "Interface"), &iface)) { iface = xstrdup("eth0"); } - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) { + if(!get_config_string(lookup_config(&config_tree, "Device"), &device)) { device = xstrdup(iface); } @@ -51,8 +51,6 @@ static bool setup_device(void) { return false; } - memset(&ifr, 0, sizeof(ifr)); - #ifdef FD_CLOEXEC fcntl(device_fd, F_SETFD, FD_CLOEXEC); #endif @@ -67,7 +65,6 @@ static bool setup_device(void) { return false; } - memset(&sa, '0', sizeof(sa)); sa.sll_family = AF_PACKET; sa.sll_protocol = htons(ETH_P_ALL); sa.sll_ifindex = ifr.ifr_ifindex;