[PATCH] osmo-ggsn[master]: ggsn: Don't explicitly use tun_setaddr() API anymore

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
Wed Apr 25 18:46:27 UTC 2018


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

ggsn: Don't explicitly use tun_setaddr() API anymore

tun_addaddr() internally contains a fallback to tun_setaddr() for the
first address, so we can unify the API usage a bit and use tun_addaddr()
from all call sites

Change-Id: I34de003a1a040254bd38b29e48caea34cb0c88d2
---
M ggsn/ggsn.c
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index bbdb5c8..85a2211 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -220,7 +220,7 @@
 		if (apn->v4.cfg.ifconfig_prefix.addr.len) {
 			LOGPAPN(LOGL_INFO, apn, "Setting tun IP address %s\n",
 				in46p_ntoa(&apn->v4.cfg.ifconfig_prefix));
-			if (tun_setaddr(apn->tun.tun, &apn->v4.cfg.ifconfig_prefix.addr, NULL,
+			if (tun_addaddr(apn->tun.tun, &apn->v4.cfg.ifconfig_prefix.addr, NULL,
 					apn->v4.cfg.ifconfig_prefix.prefixlen)) {
 				LOGPAPN(LOGL_ERROR, apn, "Failed to set tun IPv4 address %s: %s\n",
 					in46p_ntoa(&apn->v4.cfg.ifconfig_prefix), strerror(errno));
@@ -232,7 +232,7 @@
 		if (apn->v6.cfg.ifconfig_prefix.addr.len) {
 			LOGPAPN(LOGL_INFO, apn, "Setting tun IPv6 address %s\n",
 				in46p_ntoa(&apn->v6.cfg.ifconfig_prefix));
-			if (tun_setaddr(apn->tun.tun, &apn->v6.cfg.ifconfig_prefix.addr, NULL,
+			if (tun_addaddr(apn->tun.tun, &apn->v6.cfg.ifconfig_prefix.addr, NULL,
 					apn->v6.cfg.ifconfig_prefix.prefixlen)) {
 				LOGPAPN(LOGL_ERROR, apn, "Failed to set tun IPv6 address %s: %s. "
 					"Ensure you have ipv6 support and not used the disable_ipv6 sysctl?\n",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34de003a1a040254bd38b29e48caea34cb0c88d2
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