Project

General

Profile

Bug #1896

ggsn unable to set tun interface on FreeBSD v11

Added by dev9null almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
12/23/2016
Due date:
% Done:

0%

Spec Reference:

Description

Trying to start-up ggsn on a FreeBSD v11 box with

listen: 1.1.1.1
net 192.168.1.0/24
dynip: 192.168.1.0/24

results in errno 22 from tun.c

root@soak01:~ # ggsn -c /usr/local/etc/ggsn.conf -f -d                                                                                         
listen: (null)
conf: /usr/local/etc/ggsn.conf
fg: 1
debug: 1
qos: 0x0b921f
apn: internet
net: 192.168.0.0/24
pidfile: /var/run/ggsn.pid
statedir: /var/lib/ggsn/
timelimit: 0
cmdline_parser_configfile
listen: 1.1.1.1
conf: /usr/local/etc/ggsn.conf
fg: 1
debug: 1
qos: 0x0b921f
apn: internet
net: 192.168.1.0/24
dynip: 192.168.1.0/24
pidfile: /var/run/ggsn.pid
statedir: /var/lib/ggsn/
timelimit: 0
<000c> gtp.c:700 GTP: gtp_newgsn() started
<0001> tun.c:443 errno=22/Invalid argument ioctl(SIOCSIFADDR) failed
<0002> ggsn.c:518 Failed to set tun IP address

ggsn is able to create the tun0 interface

root@soak01:/usr/local/etc # ifconfig
vmx0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6>
        ether 00:50:56:b1:95:31
        inet 10.5.8.201 netmask 0xffffff00 broadcast 10.5.8.255 
        inet6 fe80::250:56ff:feb1:9531%vmx0 prefixlen 64 scopeid 0x1 
        inet6 2001:1890:12f2:20::a05:8c9 prefixlen 64 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
vmx1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=60039b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,TSO6,RXCSUM_IPV6,TXCSUM_IPV6>
        ether 00:50:56:b1:55:8c
        inet 1.1.1.1 netmask 0xffffff00 broadcast 1.1.1.255 
        inet6 fe80::250:56ff:feb1:558c%vmx1 prefixlen 64 scopeid 0x2 
        inet6 fdf6:4cfb:1::1 prefixlen 64 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: lo 
tun0: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: tun 

This looks to be the code section where it is failing:

 if (addr) { /* Set the interface address */
    this->addr.s_addr = addr->s_addr;
    memcpy(&((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr, addr,
      sizeof(*addr));
    if (ioctl(fd, SIOCSIFADDR, (void *) &ifr) < 0) {
      if (errno != EEXIST) {
    sys_err(LOG_ERR, __FILE__, __LINE__, errno,
        "ioctl(SIOCSIFADDR) failed");
      }
      else {
    sys_err(LOG_WARNING, __FILE__, __LINE__, errno,
        "ioctl(SIOCSIFADDR): Address already exists");
      }
      close(fd);
      return -1;
    }
  }

The server is running

FreeBSD soak01.eng.paloaltonetworks.local 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

and

openggsn-0.92

was install using the pkg command

History

#1 Updated by dev9null almost 2 years ago

The ggsn.conf file used for this server

 # cat ggsn.conf 
##############################################################################
#
# ggsn configuration file
#
##############################################################################

# TAG: fg
# Include this flag if process is to run in the foreground
#
#fg

# TAG: debug
# Include this flag to include debug information.
#debug

# TAG: conf
# Configuration file to use. This file is the configuration file, 
# so changing this parameter in the configuration file does not make
# sense. Use it on the command line instead.

# TAG: pidfile
# File to store information about the process id of the program.
# The program must have write access to this file/directory.
pidfile /var/run/ggsn.pid

# TAG: statedir
# Directory to use for nonvolatile storage. 
# The program must have write access to this directory.
statedir /var/lib/ggsn/

# TAG: listen
# Specifies the local IP address to listen to
listen 1.1.1.1

# TAG: net
# IP network address of external packet data network
# Used to set up network interface.
net 192.168.1.0/24

# TAG: ipup
# Script executed after network interface has been brought up.
# Executed with the following parameters: <devicename> <ip address>
#ipup /etc/ggsn/ip-up

# TAG: ipdown
# Script executed after network interface has been taken down.
# Executed with the following parameters: <devicename> <ip address>
#ipdown /etc/ggsn/ip-down

# TAG: dynip
# Dynamic IP address pool.
# Used for allocation of dynamic IP address when address is not given
# by HLR.
# If this option is not given then the net option is used as a substitute.
dynip 192.168.1.0/24

# TAG: statip
# Use of this tag is currently UNSUPPORTED
# Static IP address pool.
# Used for allocation of static IP address by means of HLR.
#statip 192.168.1.0/24

# TAG: pcodns1
# Protocol configuration option domain name system server 1.
#pcodns1 0.0.0.0

# TAG: pcodns2
# Protocol configuration option domain name system server 2.
#pcodns2 0.0.0.0

# TAG: timelimit
# Exit after timelimit seconds.
# Setting timelimit to zero will cause the program not to exit.
#timelimit 0

# TAG: apn
# Use of this tag is EXPERIMENTAL
# Access point name to connect to when run in client mode.
#apn internet

# TAG: qos
# Use of this tag is EXPERIMENTAL
# Requested Quality of Service used when run in client mode.
# 3 bytes corresponding to ????
#qos 0x0b921f

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)