Remove redundant send_from logging code.

This commit is contained in:
Simon Kelley
2012-04-04 22:13:17 +01:00
parent 89382bacaa
commit 50303b19d8
4 changed files with 8 additions and 15 deletions

View File

@@ -916,7 +916,7 @@ void server_gone(struct server *server);
struct frec *get_new_frec(time_t now, int *wait); struct frec *get_new_frec(time_t now, int *wait);
int send_from(int fd, int nowild, char *packet, size_t len, int send_from(int fd, int nowild, char *packet, size_t len,
union mysockaddr *to, struct all_addr *source, union mysockaddr *to, struct all_addr *source,
unsigned int iface, int *errp); unsigned int iface);
/* network.c */ /* network.c */
int indextoname(int fd, int index, char *name); int indextoname(int fd, int index, char *name);

View File

@@ -28,7 +28,7 @@ static struct randfd *allocate_rfd(int family);
unless nowild is true, when we just send it with the kernel default */ unless nowild is true, when we just send it with the kernel default */
int send_from(int fd, int nowild, char *packet, size_t len, int send_from(int fd, int nowild, char *packet, size_t len,
union mysockaddr *to, struct all_addr *source, union mysockaddr *to, struct all_addr *source,
unsigned int iface, int *errp) unsigned int iface)
{ {
struct msghdr msg; struct msghdr msg;
struct iovec iov[1]; struct iovec iov[1];
@@ -110,10 +110,7 @@ int send_from(int fd, int nowild, char *packet, size_t len,
if (retry_send()) if (retry_send())
goto retry; goto retry;
if (errp) my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
*errp = errno;
else
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
return 0; return 0;
} }
@@ -439,7 +436,7 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
if (udpfd != -1) if (udpfd != -1)
{ {
plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl); plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl);
send_from(udpfd, option_bool(OPT_NOWILD), (char *)header, plen, udpaddr, dst_addr, dst_iface, NULL); send_from(udpfd, option_bool(OPT_NOWILD), (char *)header, plen, udpaddr, dst_addr, dst_iface);
} }
return 0; return 0;
@@ -628,7 +625,7 @@ void reply_query(int fd, int family, time_t now)
header->id = htons(forward->orig_id); header->id = htons(forward->orig_id);
header->hb4 |= HB4_RA; /* recursion if available */ header->hb4 |= HB4_RA; /* recursion if available */
send_from(forward->fd, option_bool(OPT_NOWILD), daemon->packet, nn, send_from(forward->fd, option_bool(OPT_NOWILD), daemon->packet, nn,
&forward->source, &forward->dest, forward->iface, NULL); &forward->source, &forward->dest, forward->iface);
} }
free_frec(forward); /* cancel */ free_frec(forward); /* cancel */
} }
@@ -823,7 +820,7 @@ void receive_query(struct listener *listen, time_t now)
if (m >= 1) if (m >= 1)
{ {
send_from(listen->fd, option_bool(OPT_NOWILD), (char *)header, send_from(listen->fd, option_bool(OPT_NOWILD), (char *)header,
m, &source_addr, &dst_addr, if_index, NULL); m, &source_addr, &dst_addr, if_index);
daemon->local_answer++; daemon->local_answer++;
} }
else if (forward_query(listen->fd, &source_addr, &dst_addr, if_index, else if (forward_query(listen->fd, &source_addr, &dst_addr, if_index,

View File

@@ -320,7 +320,7 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr); inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr);
send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0), send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0),
(union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface, NULL); (union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface);
} }

View File

@@ -158,11 +158,7 @@ time_t periodic_slaac(time_t now, struct dhcp_lease *leases)
if (sendto(daemon->icmp6fd, daemon->outpacket.iov_base, save_counter(0), 0, if (sendto(daemon->icmp6fd, daemon->outpacket.iov_base, save_counter(0), 0,
(struct sockaddr *)&addr, sizeof(addr)) == -1 && (struct sockaddr *)&addr, sizeof(addr)) == -1 &&
errno == EHOSTUNREACH) errno == EHOSTUNREACH)
{ slaac->ping_time = 0; /* Give up */
slaac->ping_time = 0; /* Give up */
inet_ntop(AF_INET6, &addr, daemon->addrbuff, ADDRSTRLEN);
my_syslog(MS_DHCP | LOG_INFO, "SLAAC-HOSTUNREACH %s", daemon->addrbuff);
}
else else
{ {
slaac->ping_time += (1 << (slaac->backoff - 1)) + (rand16()/21785); /* 0 - 3 */ slaac->ping_time += (1 << (slaac->backoff - 1)) + (rand16()/21785); /* 0 - 3 */