From 6e5f9980a8a71015a228279e07970621d23c7b35 Mon Sep 17 00:00:00 2001 From: Volodymyr Huti Date: Thu, 13 Oct 2022 14:20:06 +0300 Subject: 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 --- accel-pppd/ctrl/ipoe/dhcpv4.c | 2 +- accel-pppd/ctrl/ipoe/dhcpv4.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'accel-pppd/ctrl/ipoe') 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 -- cgit v1.2.3