2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 01:49:35 +00:00

- sendmsg()/recvmsg() control buffers are now declared in such a way to

ensure they are correctly aligned on all (esp. 64-bit) architectures.
  [ISC-Bugs #17087b]
This commit is contained in:
David Hankins 2007-10-23 21:39:56 +00:00
parent edb1283e10
commit c71c6399b1
2 changed files with 15 additions and 6 deletions

View File

@ -61,6 +61,9 @@ suggested fixes to <dhcp-users@isc.org>.
'never used' leases will no longer consistently shift between servers
on every pool rebalance run.
- sendmsg()/recvmsg() control buffers are now declared in such a way to
ensure they are correctly aligned on all (esp. 64-bit) architectures.
Changes since 4.0.0a3
- The DHCP server no longer requires a "ddns-update-style" statement,

View File

@ -437,8 +437,11 @@ ssize_t send_packet6(struct interface_info *interface,
struct iovec v;
int result;
struct in6_pktinfo *pktinfo;
char pbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
struct cmsghdr *cmsg;
union {
struct cmsghdr cmsg_sizer;
u_int8_t pktinfo_sizer[CMSG_SPACE(sizeof(struct in6_pktinfo))];
} control_buf;
/*
* Initialize our message header structure.
@ -469,8 +472,8 @@ ssize_t send_packet6(struct interface_info *interface,
* source address if we wanted, but we can safely let the
* kernel decide what that should be.
*/
m.msg_control = pbuf;
m.msg_controllen = sizeof(pbuf);
m.msg_control = &control_buf;
m.msg_controllen = sizeof(control_buf);
cmsg = CMSG_FIRSTHDR(&m);
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
@ -530,11 +533,14 @@ receive_packet6(struct interface_info *interface,
struct sockaddr_in6 *from, struct in6_addr *to_addr) {
struct msghdr m;
struct iovec v;
char pbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
int result;
struct cmsghdr *cmsg;
struct in6_pktinfo *pktinfo;
int found_to_addr;
union {
struct cmsghdr cmsg_sizer;
u_int8_t pktinfo_sizer[CMSG_SPACE(sizeof(struct in6_pktinfo))];
} control_buf;
/*
* Initialize our message header structure.
@ -565,8 +571,8 @@ receive_packet6(struct interface_info *interface,
* information (when we initialized the interface), so we
* should get the destination address from that.
*/
m.msg_control = pbuf;
m.msg_controllen = sizeof(pbuf);
m.msg_control = &control_buf;
m.msg_controllen = sizeof(control_buf);
result = recvmsg(interface->rfdesc, &m, 0);