diff options
author | Volodymyr Huti <volodymyr.huti@gmail.com> | 2022-10-13 14:20:06 +0300 |
---|---|---|
committer | Volodymyr Huti <volodymyr.huti@gmail.com> | 2022-10-22 15:11:29 +0300 |
commit | 6e5f9980a8a71015a228279e07970621d23c7b35 (patch) | |
tree | 73ae1d6596a175c76a0d24867592a4016c0592c5 /accel-pppd/ctrl/ipoe | |
parent | 2b865db72bc2ddc6411950d72f1c23e8ef115b8a (diff) | |
download | accel-ppp-6e5f9980a8a71015a228279e07970621d23c7b35.tar.gz accel-ppp-6e5f9980a8a71015a228279e07970621d23c7b35.zip |
T72: Fix compilations warnings for unaligned variable access
- IPoE/DHCP4: Specify minimal suitable alignment explicitly.
We need to guarantee 2 byte alignment for the `hdr` pointer in
`ip_csum(uint16_t *buf)` calculation
- PPPOE: Suppress false-positive warning for `sockaddr_pppox`.
Similiar issue: https://github.com/kernelslacker/trinity/pull/40
- Introduce tmp variables to avoid alignment issues for SSTP/DHCPv6
For additional details:
https://phabricator.accel-ppp.org/T72
Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcpv4.c | 2 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcpv4.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c index f1d9c46..41cbe50 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.c +++ b/accel-pppd/ctrl/ipoe/dhcpv4.c @@ -625,7 +625,7 @@ static int dhcpv4_send_raw(struct dhcpv4_serv *serv, struct dhcpv4_packet *pack, struct iphdr ip; struct udphdr udp; uint8_t data[0]; - } __packed *hdr; + } __packed __aligned(2) *hdr; struct sockaddr_ll ll_addr; int n, len = pack->ptr - pack->data; diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.h b/accel-pppd/ctrl/ipoe/dhcpv4.h index 8598b61..796b858 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.h +++ b/accel-pppd/ctrl/ipoe/dhcpv4.h @@ -8,6 +8,7 @@ #include "triton.h" +#define __aligned(n) __attribute__((aligned (n))) #define __packed __attribute__((packed)) #define DHCP_SERV_PORT 67 |