"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dhcp-common.c" between
dnsmasq-2.81.tar.xz and dnsmasq-2.82.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

dhcp-common.c  (dnsmasq-2.81.tar.xz):dhcp-common.c  (dnsmasq-2.82.tar.xz)
skipping to change at line 41 skipping to change at line 41
even for v6 */ even for v6 */
expand_buf(&daemon->dhcp_packet, sizeof(struct dhcp_packet)); expand_buf(&daemon->dhcp_packet, sizeof(struct dhcp_packet));
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
if (daemon->dhcp6) if (daemon->dhcp6)
expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet)); expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet));
#endif #endif
} }
ssize_t recv_dhcp_packet(int fd, struct msghdr *msg) ssize_t recv_dhcp_packet(int fd, struct msghdr *msg)
{ {
ssize_t sz; ssize_t sz, new_sz;
while (1) while (1)
{ {
msg->msg_flags = 0; msg->msg_flags = 0;
while ((sz = recvmsg(fd, msg, MSG_PEEK | MSG_TRUNC)) == -1 && errno == EIN TR); while ((sz = recvmsg(fd, msg, MSG_PEEK | MSG_TRUNC)) == -1 && errno == EIN TR);
if (sz == -1) if (sz == -1)
return -1; return -1;
if (!(msg->msg_flags & MSG_TRUNC)) if (!(msg->msg_flags & MSG_TRUNC))
skipping to change at line 68 skipping to change at line 68
if (!expand_buf(msg->msg_iov, sz + 100)) if (!expand_buf(msg->msg_iov, sz + 100))
return -1; return -1;
} }
else else
{ {
expand_buf(msg->msg_iov, sz); expand_buf(msg->msg_iov, sz);
break; break;
} }
} }
while ((sz = recvmsg(fd, msg, 0)) == -1 && errno == EINTR); while ((new_sz = recvmsg(fd, msg, 0)) == -1 && errno == EINTR);
return (msg->msg_flags & MSG_TRUNC) ? -1 : sz; /* Some kernels seem to ignore MSG_PEEK, and dequeue the packet anyway.
If that happens we get EAGAIN here because the socket is non-blocking.
Use the result of the original testing recvmsg as long as the buffer
was big enough. There's a small race here that may lose the odd packet,
but it's UDP anyway. */
if (new_sz == -1 && (errno == EWOULDBLOCK || errno == EAGAIN))
new_sz = sz;
return (msg->msg_flags & MSG_TRUNC) ? -1 : new_sz;
} }
struct dhcp_netid *run_tag_if(struct dhcp_netid *tags) struct dhcp_netid *run_tag_if(struct dhcp_netid *tags)
{ {
struct tag_if *exprs; struct tag_if *exprs;
struct dhcp_netid_list *list; struct dhcp_netid_list *list;
for (exprs = daemon->tag_if; exprs; exprs = exprs->next) for (exprs = daemon->tag_if; exprs; exprs = exprs->next)
if (match_netid(exprs->tag, tags, 1)) if (match_netid(exprs->tag, tags, 1))
for (list = exprs->set; list; list = list->next) for (list = exprs->set; list; list = list->next)
 End of changes. 3 change blocks. 
3 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)