A return-value of zero is not an error, so there's no point calling perror, but since we have not requested and don't expect a zero-length datagram, we treat it as EOF and exit. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- extensions/pknock/pknlusr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/pknock/pknlusr.c b/extensions/pknock/pknlusr.c index 9f11250510a1..2dd9ab7b9705 100644 --- a/extensions/pknock/pknlusr.c +++ b/extensions/pknock/pknlusr.c @@ -59,11 +59,14 @@ int main(void) status = recv(sock_fd, nlmsg, nlmsg_size, 0); - if (status <= 0) { + if (status < 0) { perror("recv()"); return 1; } + if (status == 0) + break; + cn_msg = NLMSG_DATA(nlmsg); pknock_msg = (struct xt_pknock_nl_msg *)(cn_msg->data); ip = inet_ntop(AF_INET, &pknock_msg->peer_ip, ipbuf, sizeof(ipbuf)); -- 2.28.0