[PATCH xtables-addons v2 04/13] pknock: pknlusr: tidy up initialization of local address.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use struct initialization and drop memset.  We don't need to set the port
ID, since the kernel will do it for us.

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 extensions/pknock/pknlusr.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/extensions/pknock/pknlusr.c b/extensions/pknock/pknlusr.c
index 808b737f1db2..ed741599558b 100644
--- a/extensions/pknock/pknlusr.c
+++ b/extensions/pknock/pknlusr.c
@@ -17,7 +17,7 @@ int main(void)
 	int status;
 	int group = GROUP;
 
-	struct sockaddr_nl local_addr;
+	struct sockaddr_nl local_addr = { .nl_family = AF_NETLINK };
 	int sock_fd;
 
 	int buf_size;
@@ -30,9 +30,6 @@ int main(void)
 		return 1;
 	}
 
-	memset(&local_addr, 0, sizeof(local_addr));
-	local_addr.nl_family = AF_NETLINK;
-	local_addr.nl_pid = getpid();
 	local_addr.nl_groups = group;
 
 	status = bind(sock_fd, (struct sockaddr*)&local_addr, sizeof(local_addr));
-- 
2.28.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux