struct ip6_hdr ip6;
struct tcphdr tcp;
} ip6pkt;
+ int saved_errno;
switch (src->ip.sin_family) {
case AF_INET:
return -1;
}
- ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip));
+ ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0,
+ &dest->ip, sizeof(dest->ip));
+ saved_errno = errno;
close(s);
if (ret != sizeof(ip4pkt)) {
- DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_ERR,
+ ("Failed sendto (%s)\n", strerror(saved_errno)));
return -1;
}
break;
tmpport = tmpdest->ip6.sin6_port;
tmpdest->ip6.sin6_port = 0;
- ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, &dest->ip6, sizeof(dest->ip6));
+ ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0,
+ &dest->ip6, sizeof(dest->ip6));
+ saved_errno = errno;
tmpdest->ip6.sin6_port = tmpport;
close(s);
if (ret != sizeof(ip6pkt)) {
- DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_ERR,
+ ("Failed sendto (%s)\n", strerror(saved_errno)));
return -1;
}
break;
return -1;
}
+ ZERO_STRUCTP(src);
+ ZERO_STRUCTP(dst);
+
/* Ethernet */
eth = (struct ether_header *)pkt;