[MERGED] osmo-ggsn[master]: tun: Don't copy 16byte IPv6 address to 'struct in_addr'

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Nov 5 19:08:10 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: tun: Don't copy 16byte IPv6 address to 'struct in_addr'
......................................................................


tun: Don't copy 16byte IPv6 address to 'struct in_addr'

The 'struct tun' curently only has an in_addr (v4-only) member to
store the address of the tun device, so let's not attempt to store
an IPv6 address in it.

FIXME: This entire code needs an overhaul. The assumption that there's
only one address, and only either v6 or v4 is broken to begin with.

Change-Id: If0b626d688841d6e0a3867834f4cb1b70084050e
Fixes: Coverity CID#174278
---
M lib/tun.c
1 file changed, 0 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/lib/tun.c b/lib/tun.c
index 6bcc13b..3c293a2 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -396,7 +396,6 @@
 
 #if defined(__linux__)
 	if (addr) {
-		memcpy(&this->addr, addr, sizeof(*addr));
 		memcpy(&ifr.ifr6_addr, addr, sizeof(*addr));
 		if (ioctl(fd, SIOCSIFADDR, (void *) &ifr) < 0) {
 			if (errno != EEXIST) {

-- 
To view, visit https://gerrit.osmocom.org/4692
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If0b626d688841d6e0a3867834f4cb1b70084050e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list