ggsn: Use osmo_netdev_addaddr() libosmocore API

This allows dropping a lot of duplicated code.
While at it, drop references to non-linux systems, which are not
maintained anymore.
Param "dstaddr" was not used anywhere in the old APIs, so it can also be
dropped.
Param "tun->routes" was also used in BSD code, so it can also be
dropped.

Change-Id: I1fccfd658542481cd61536fbd3c7a3a32a1c253b
This commit is contained in:
Pau Espin Pedrol
2024-10-21 16:50:07 +02:00
parent 38b607ece3
commit 454110a007
6 changed files with 37 additions and 620 deletions

View File

@@ -1649,7 +1649,7 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
if (addr[i].len == 16)
prefixlen = 64;
/* printf("Setting up interface and routing\n"); */
tun_addaddr(tun, &addr[i], NULL, prefixlen);
tun_addaddr(tun, &addr[i], prefixlen);
if (options.defaultroute) {
if (in46a_is_v4(&addr[i])) {
struct in_addr rm;
@@ -1786,7 +1786,7 @@ static void handle_router_adv(struct pdp_t *pdp, struct ip6_hdr *ip6h, struct ic
}
}
#endif
rc = tun_addaddr(tun, &addr, NULL, opt_prefix->prefix_len);
rc = tun_addaddr(tun, &addr, opt_prefix->prefix_len);
if (rc < 0) {
SYS_ERR(DSGSN, LOGL_ERROR, 0, "Failed to add addr %s to tun %s",
in46a_ntoa(&addr), tun->devname);
@@ -1936,7 +1936,7 @@ int main(int argc, char **argv)
}
if ((options.createif) && (options.netaddr.len)) {
tun_addaddr(tun, &options.netaddr, NULL, options.prefixlen);
tun_addaddr(tun, &options.netaddr, options.prefixlen);
if (options.defaultroute) {
if (in46a_is_v4(&options.netaddr)) {
struct in_addr rm;