[PATCH] 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 18:34:44 UTC 2017


Review at  https://gerrit.osmocom.org/4692

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/92/4692/1

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: newchange
Gerrit-Change-Id: If0b626d688841d6e0a3867834f4cb1b70084050e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list