summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2023-05-05 03:45:23 +0500
committerVladislav Grishenko <themiron@mail.ru>2023-05-05 03:51:38 +0500
commit2b0226f25bd65dbe357b751aeeb481c09df20382 (patch)
treeeb3a19daa59d6c2f1b3665425791f877a0d3d9da /accel-pppd
parent6f08e69c1694e267ecb3ee32257b97f0550d9c4d (diff)
downloadaccel-ppp-2b0226f25bd65dbe357b751aeeb481c09df20382.tar.gz
accel-ppp-2b0226f25bd65dbe357b751aeeb481c09df20382.zip
sstp: fix gcc9/clang address-of-packed-member warning
Patially fixes 6e5f9980a8a71015a228279e07970621d23c7b35, there's no really requirement for packed internal sockaddr_t struct. Also, constantify several struct pointer arguments as well.
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 9b247e4d..2e2c4d3b 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -79,7 +79,7 @@ struct sockaddr_t {
struct sockaddr_in6 sin6;
struct sockaddr_un sun;
} u;
-} __attribute__((packed));
+};
struct hash_t {
unsigned int len;
@@ -284,7 +284,7 @@ static int _vstrsep(char *buf, const char *sep, ...)
return n;
}
-static in_addr_t sockaddr_ipv4(struct sockaddr_t *addr)
+static in_addr_t sockaddr_ipv4(const struct sockaddr_t *addr)
{
switch (addr->u.sa.sa_family) {
case AF_INET:
@@ -298,9 +298,10 @@ static in_addr_t sockaddr_ipv4(struct sockaddr_t *addr)
}
}
-static int sockaddr_ntop(struct sockaddr_t *addr, char *dst, socklen_t size, int flags)
+static int sockaddr_ntop(const struct sockaddr_t *addr, char *dst, socklen_t size, int flags)
{
- char ipv6_buf[INET6_ADDRSTRLEN], *path, sign;
+ char ipv6_buf[INET6_ADDRSTRLEN], sign;
+ const char *path;
switch (addr->u.sa.sa_family) {
case AF_INET:
@@ -588,7 +589,7 @@ error:
/* proxy */
-static int proxy_parse(struct buffer_t *buf, struct sockaddr_t *peer, struct sockaddr_t *addr)
+static int proxy_parse(const struct buffer_t *buf, struct sockaddr_t *peer, struct sockaddr_t *addr)
{
static const uint8_t proxy_sig[] = PROXY_SIG;
struct proxy_hdr *hdr;
@@ -647,7 +648,7 @@ error:
return -1;
}
-static int proxy_parse_v2(struct buffer_t *buf, struct sockaddr_t *peer, struct sockaddr_t *addr)
+static int proxy_parse_v2(const struct buffer_t *buf, struct sockaddr_t *peer, struct sockaddr_t *addr)
{
static const uint8_t proxy2_sig[] = PROXY2_SIG;
struct proxy2_hdr *hdr;