diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-10-16 14:41:37 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-10-16 17:45:48 +0200 |
commit | a037e5908a84e8f438f8faef662f6bfcec305b16 (patch) | |
tree | 1d32b511c1e24bed412bc1350e2167537f38bc53 /ggsn | |
parent | 2e7b9ff891a0d4c84a4be3fffbac1b9502fe267c (diff) |
tun: Convert tun_ipv6_linklocal_get to be more generic
Add support for IPv4 and IPv6 global IPs. Also return the prefix length
of the IP address by using a in46_prefix.
Change-Id: I277af191dc611b6bbcb83479f4ae338083740322
Diffstat (limited to 'ggsn')
-rw-r--r-- | ggsn/ggsn.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 29d8473..ff760cf 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -149,6 +149,7 @@ int apn_stop(struct apn_ctx *apn, bool force) /* actually start the APN with its current config */ int apn_start(struct apn_ctx *apn) { + struct in46_prefix ipv6_tun_linklocal_ip; if (apn->started) return 0; @@ -201,12 +202,13 @@ int apn_start(struct apn_ctx *apn) } if (apn->cfg.apn_type_mask & (APN_TYPE_IPv6|APN_TYPE_IPv4v6)) { - if (tun_ipv6_linklocal_get(apn->tun.tun, &apn->v6_lladdr) < 0) { + if (tun_ip_local_get(apn->tun.tun, &ipv6_tun_linklocal_ip, 1, IP_TYPE_IPv6_LINK) < 1) { LOGPAPN(LOGL_ERROR, apn, "Cannot obtain IPv6 link-local address of " "interface: %s\n", strerror(errno)); apn_stop(apn, false); return -1; } + apn->v6_lladdr = ipv6_tun_linklocal_ip.addr.v6; } /* set back-pointer from TUN device to APN */ |