dmitrii.kalashnik has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/17963 )


Change subject: sgsnemu: use real tun device name after the device is up.
......................................................................

sgsnemu: use real tun device name after the device is up.

The device name option could be empty, using it without checking
would crash sgsnemu. Using the real device is better anyway.

Change-Id: Ic3934281bfc2e433323e4ab72cf5be2cbd1c962a
---
M sgsnemu/sgsnemu.c
1 file changed, 4 insertions(+), 4 deletions(-)



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

diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 4c51157..f137f2c 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1928,11 +1928,11 @@
                   we don't need it. Don't exit on error since this sysctl is
                   only available starting with linux 4.11. */
                snprintf(buf, sizeof(buf), "%u", IN6_ADDR_GEN_MODE_NONE);
-               if (proc_ipv6_conf_write(options.tun_dev_name, "addr_gen_mode", 
buf) < 0) {
+               if (proc_ipv6_conf_write(tun->devname, "addr_gen_mode", buf) < 
0) {
                        SYS_ERR(DSGSN, LOGL_ERROR, errno,
                                "Failed to disable addr_gen_mode on %s, an 
extra link-local "
                                "ip address will appear on the tun device.\n",
-                               options.tun_dev_name);
+                               tun->devname);
                }
 #endif

@@ -1940,9 +1940,9 @@
                if (tun->fd > maxfd)
                        maxfd = tun->fd;

-               if (proc_ipv6_conf_write(options.tun_dev_name, "accept_ra", 
"0") < 0) {
+               if (proc_ipv6_conf_write(tun->devname, "accept_ra", "0") < 0) {
                        SYS_ERR(DSGSN, LOGL_ERROR, 0,
-                               "Failed to disable IPv6 SLAAC on %s\n", 
options.tun_dev_name);
+                               "Failed to disable IPv6 SLAAC on %s\n", 
tun->devname);
                        exit(1);
                }
        }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/17963
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ic3934281bfc2e433323e4ab72cf5be2cbd1c962a
Gerrit-Change-Number: 17963
Gerrit-PatchSet: 1
Gerrit-Owner: dmitrii.kalashnik <[email protected]>
Gerrit-MessageType: newchange

Reply via email to