Skip to content

Commit

Permalink
wsdd2: fix msghdr initialization patch
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Dec 27, 2024
1 parent ff8a07e commit 6d24d0c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ ADD "https://github.com/Netgear/wsdd2.git#${WSDD2_VERSION}" .

# TODO: do cross-compilation in this stage to build wsdd2
FROM crazymax/alpine-s6:${ALPINE_VERSION}-${S6_VERSION} AS wsdd2
RUN apk --update --no-cache add linux-headers gcc make musl-dev
RUN apk --update --no-cache add linux-headers gcc make musl-dev patch
WORKDIR /src
COPY --from=wsdd2-src /src /src
COPY patches/wsdd2 /tmp/wsdd2-patches
RUN patch -p1 < /tmp/wsdd2-patches/0001-fix-msghdr-initialization.patch
RUN make DESTDIR=/dist install

FROM crazymax/alpine-s6:${ALPINE_VERSION}-${S6_VERSION}
Expand Down
32 changes: 32 additions & 0 deletions patches/wsdd2/0001-fix-msghdr-initialization.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 1be722c52a386d5e617cb245c5311ae79f77ff7d Mon Sep 17 00:00:00 2001
From: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Date: Fri, 27 Dec 2024 15:40:27 +0100
Subject: [PATCH] fix msghdr initialization

---
wsdd2.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/wsdd2.c b/wsdd2.c
index 4f91f6e..4d31544 100644
--- a/wsdd2.c
+++ b/wsdd2.c
@@ -543,7 +543,16 @@ static int netlink_recv(struct endpoint *ep)
char buf[PAGE_SIZE];
struct sockaddr_nl sa;
struct iovec iov = { buf, sizeof buf };
- struct msghdr msg = { &sa, sizeof sa, &iov, 1, NULL, 0, 0 };
+ struct msghdr msg = {
+ .msg_name = &sa,
+ .msg_namelen = sizeof(sa),
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ .msg_control = NULL,
+ .msg_controllen = 0,
+ .msg_flags = 0,
+ .__pad2 = 0
+ };
ssize_t msglen = recvmsg(ep->sock, &msg, 0);

DEBUG(2, W, "%s: %zd bytes", __func__, msglen);
--

0 comments on commit 6d24d0c

Please sign in to comment.