Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2163?usp=email

to review the following change.


Change subject: sitnl: put the IPv6 member first in inet_address_t
......................................................................

sitnl: put the IPv6 member first in inet_address_t

The inet_address_t locals are initialized with "= { 0 }", which only
initializes the first union member, the 4 byte ipv4. GCC 15 and later
no longer clear the rest of the union for this, so the IPv6 addresses
of these locals keep up to 12 bytes of stack garbage when the caller
passes no address.

net_route_v6_del() then sends a garbage RTA_GATEWAY for routes without
a gateway, and the kernel refuses to delete them. net_route_v6_best_gw()
looks up a garbage destination when asked for the default route.

With ipv6 first, "= { 0 }" clears the whole union.

Latent since c6542257 ("introduce sitnl: Simplified Interface To
NetLink").

Change-Id: I5c52cc5c3aaad21d1c22f36f6451235302ea6c4f
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/networking_sitnl.c
1 file changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/2163/1

diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index 97ff7bd..157b784 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -84,13 +84,18 @@
 /**
  * Generic address data structure used to pass addresses and prefixes as
  * argument to AF family agnostic functions
+ *
+ * ipv6 comes first, so that "= { 0 }" clears the whole union; it only
+ * initializes the first member.
  */
 typedef union
 {
-    in_addr_t ipv4;
     struct in6_addr ipv6;
+    in_addr_t ipv4;
 } inet_address_t;

+static_assert(sizeof(inet_address_t) == sizeof(struct in6_addr), "ipv6 must be 
the largest member");
+
 /**
  * Link state request message
  */

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2163?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5c52cc5c3aaad21d1c22f36f6451235302ea6c4f
Gerrit-Change-Number: 2163
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
  • [Openvpn-devel] [XS] Cha... Code Review

Reply via email to