Projects
osmocom:nightly
osmo-ggsn
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 698
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/contrib/osmo-ggsn.init
Deleted
@@ -1,97 +0,0 @@ -#!/bin/sh -# -# osmo-ggsn This shell script takes care of starting and stopping -# osmo-ggsn. -# -# chkconfig: - 65 35 -# description: osmo-ggsn is a Gateway GPRS Support Node. - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -if -f /etc/sysconfig/osmo-ggsn ; then - . /etc/sysconfig/osmo-ggsn -fi - -# Check that networking is up. - ${NETWORKING} = "no" && exit 0 - - -f /usr/bin/osmo-ggsn || exit 0 - -f /etc/osmo-ggsn.cfg || exit 0 - -RETVAL=0 -prog="osmo-ggsn" - -start() { - # Start daemons. - echo -n $"Starting $prog: " - - # Load tun module - /sbin/modprobe tun >/dev/null 2>&1 - - # Enable routing of packets: WARNING!!! - # Users should enable this explicitly - # echo 1 > /proc/sys/net/ipv4/ip_forward - - # Check for runtime directory of nonvolatile data - if ! -d /var/lib/osmo-ggsn ; then - mkdir /var/lib/osmo-ggsn - fi - - # Check for GTP restart counter - if ! -d /var/lib/osmo-ggsn/gsn_restart ; then - echo 0 > /var/lib/osmo-ggsn/gsn_restart - fi - - - daemon /usr/bin/osmo-ggsn - RETVAL=$? - echo - $RETVAL -eq 0 && touch /var/lock/subsys/osmo-ggsn - return $RETVAL -} - -stop() { - # Stop daemons. - echo -n $"Shutting down $prog: " - killproc osmo-ggsn - RETVAL=$? - echo - $RETVAL = 0 && rm -f /var/lock/subsys/osmo-ggsn /var/run/osmo-ggsn.pid - return $RETVAL -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - stop - start - RETVAL=$? - ;; - condrestart) - if -f /var/lock/subsys/osmo-ggsn ; then - stop - start - RETVAL=$? - fi - ;; - status) - status osmo-ggsn - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 -esac - -exit $RETVAL -
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/debian/osmo-ggsn.init
Deleted
@@ -1,163 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: osmo-ggsn -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Gateway GPRS Support Node -# Description: Gateway GPRS Support Node -### END INIT INFO - -# Author: Harald Welte <laforge@gnumonks.org> - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="OsmoGGSN Gateway GPRS Support Node" -NAME=ggsn -DAEMON=/usr/bin/osmo-ggsn -DAEMON_ARGS="" # Arguments to run the daemon with -PIDFILE=/var/run/$NAME.pid -SCRIPTNAME=/etc/init.d/osmo-ggsn - -# Exit if the package is not installed - -x $DAEMON || exit 0 - -# Read configuration variable file if it is present - -r /etc/default/osmo-ggsn && . /etc/default/osmo-ggsn - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -DAEMON_ARGS="$DAEMON_ARGS" - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ - || return 1 - - # Check for runtime directory of nonvolatile data - if ! -d /var/lib/osmo-ggsn ; then - mkdir /var/lib/osmo-ggsn - fi - - # Check for GTP restart counter - if ! -f /var/lib/osmo-ggsn/gsn_restart ; then - echo 0 > /var/lib/osmo-ggsn/gsn_restart - fi - - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - $DAEMON_ARGS \ - || return 2 - # Add code here, if necessary, that waits for the process to be ready - # to handle requests from services started subsequently which depend - # on this one. As a last resort, sleep for some time. -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME - RETVAL="$?" - "$RETVAL" = 2 && return 2 - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON - "$?" = 2 && return 2 - # Many daemons don't delete their pidfiles when they exit. - rm -f $PIDFILE - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME - return 0 -} - -case "$1" in - start) - "$VERBOSE" != no && log_daemon_msg "Starting $DESC " "$NAME" - do_start - case "$?" in - 0|1) "$VERBOSE" != no && log_end_msg 0 ;; - 2) "$VERBOSE" != no && log_end_msg 1 ;; - esac - ;; - stop) - "$VERBOSE" != no && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) "$VERBOSE" != no && log_end_msg 0 ;; - 2) "$VERBOSE" != no && log_end_msg 1 ;; - esac - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -:
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/gsn.h
Deleted
@@ -1,181 +0,0 @@ -/* - * OsmoGGSN - Gateway GPRS Support Node - * Copyright (C) 2002, 2003, 2004 Mondru AB. - * - * The contents of this file may be used under the terms of the GNU - * General Public License Version 2, provided that the above copyright - * notice and this permission notice is included in all copies or - * substantial portions of the software. - * - */ - -#ifndef _GSN_H -#define _GSN_H - -#include <osmocom/core/utils.h> -#include <osmocom/core/defs.h> -#include <osmocom/core/timer.h> -#include <osmocom/core/tdef.h> -#include <osmocom/core/rate_ctr.h> - -#include "pdp.h" - -#define GTP_MODE_GGSN 1 -#define GTP_MODE_SGSN 2 - -#define RESTART_FILE "gsn_restart" - -extern struct osmo_tdef gtp_T_defs; - -/* *********************************************************** - * Information storage for each gsn instance - * - * Normally each instance of the application corresponds to - * one instance of a gsn. - * - * In order to avoid global variables in the application, and - * also in order to allow several instances of a gsn in the same - * application this struct is provided in order to store all - * relevant information related to the gsn. - * - * Note that this does not include information storage for ' - * each pdp context. This is stored in another struct. - *************************************************************/ - -enum gsn_rate_ctr_keys { - GSN_CTR_ERR_SOCKET, - GSN_CTR_ERR_READFROM, /* Number of readfrom errors */ - GSN_CTR_ERR_SENDTO, /* Number of sendto errors */ - GSN_CTR_ERR_QUEUEFULL, /* Number of times queue was full */ - GSN_CTR_ERR_SEQ, /* Number of seq out of range */ - GSN_CTR_ERR_ADDRESS, /* GSN address conversion failed */ - GSN_CTR_ERR_UNKNOWN_PDP, /* GSN address conversion failed */ - GSN_CTR_ERR_UNEXPECTED_CAUSE, /* Unexpected cause value received */ - GSN_CTR_ERR_OUT_OF_PDP, /* Out of storage for PDP contexts */ - GSN_CTR_PKT_EMPTY, /* Number of empty packets */ - GSN_CTR_PKT_UNSUP, /* Number of unsupported version 29.60 11.1.1 */ - GSN_CTR_PKT_TOOSHORT, /* Number of too short headers 29.60 11.1.2 */ - GSN_CTR_PKT_UNKNOWN, /* Number of unknown messages 29.60 11.1.3 */ - GSN_CTR_PKT_UNEXPECT, /* Number of unexpected messages 29.60 11.1.4 */ - GSN_CTR_PKT_DUPLICATE, /* Number of duplicate or unsolicited replies */ - GSN_CTR_PKT_MISSING, /* Number of missing information field messages */ - GSN_CTR_PKT_INCORRECT, /* Number of incorrect information field messages */ - GSN_CTR_PKT_INVALID, /* Number of invalid message format messages */ -}; - -/* 3GPP TS 29.006 14.1, 14,2 */ -enum gtp_gsn_timers { - GTP_GSN_TIMER_T3_RESPONSE = 3, - GTP_GSN_TIMER_N3_REQUESTS = 1003, - GTP_GSN_TIMER_T3_HOLD_RESPONSE = -3, -}; - -struct gsn_t { - /* Parameters related to the network interface */ - - int fd0; /* GTP0 file descriptor */ - int fd1c; /* GTP1 control plane file descriptor */ - int fd1u; /* GTP0 user plane file descriptor */ - int mode; /* Mode of operation: GGSN or SGSN */ - struct in_addr gsnc; /* IP address of this gsn for signalling */ - struct in_addr gsnu; /* IP address of this gsn for user traffic */ - - /* Parameters related to signalling messages */ - uint16_t seq_next; /* Next sequence number to use */ - int seq_first; /* First packet in queue (oldest timeout) */ - int seq_last; /* Last packet in queue (youngest timeout) */ - - unsigned char restart_counter; /* Increment on restart. Stored on disk */ - char *statedir; /* Disk location for permanent storage */ - void *priv; /* used by libgtp users to attach their own state) */ - struct queue_t *queue_req; /* Request queue */ - struct queue_t *queue_resp; /* Response queue */ - - struct pdp_t pdpaPDP_MAX; /* PDP storage */ - struct pdp_t *hashtidPDP_MAX; /* Hash table for IMSI + NSAPI */ - - struct osmo_timer_list queue_timer; /* internal queue_{req,resp} timer */ - - /* Call back functions */ - int (*cb_delete_context) (struct pdp_t *); - int (*cb_create_context_ind) (struct pdp_t *); - int (*cb_unsup_ind) (struct sockaddr_in * peer); - int (*cb_extheader_ind) (struct sockaddr_in * peer); - int (*cb_ran_info_relay_ind) (struct sockaddr_in *peer, union gtpie_member **ie); - int (*cb_conf) (int type, int cause, struct pdp_t * pdp, void *cbp); - int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len); - int (*cb_recovery) (struct sockaddr_in * peer, uint8_t recovery); - int (*cb_recovery2) (struct sockaddr_in * peer, struct pdp_t * pdp, uint8_t recovery); - int (*cb_recovery3) (struct gsn_t *gsn, struct sockaddr_in *peer, struct pdp_t *pdp, uint8_t recovery); - - /* Counters */ - struct rate_ctr_group *ctrg; - - /* Timers: */ - struct osmo_tdef *tdef; -}; - -/* External API functions */ - -extern int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen, - int mode); - -extern int gtp_free(struct gsn_t *gsn); - -extern int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp, - uint64_t imsi, uint8_t nsapi) OSMO_DEPRECATED("Use gtp_pdp_newpdp() instead"); -extern int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp); -extern int gtp_freepdp_teardown(struct gsn_t *gsn, struct pdp_t *pdp); - -extern int gtp_create_context_req(struct gsn_t *gsn, struct pdp_t *pdp, - void *cbp); - -extern int gtp_set_cb_create_context_ind(struct gsn_t *gsn, - int (*cb_create_context_ind) (struct - pdp_t * - pdp)); -extern int gtp_set_cb_data_ind(struct gsn_t *gsn, - int (*cb_data_ind) (struct pdp_t * pdp, - void *pack, unsigned len)); -extern int gtp_set_cb_delete_context(struct gsn_t *gsn, - int (*cb_delete_context) (struct pdp_t * - pdp)); -/*extern int gtp_set_cb_create_context(struct gsn_t *gsn, - int (*cb_create_context) (struct pdp_t* pdp)); */ - -extern int gtp_set_cb_unsup_ind(struct gsn_t *gsn, - int (*cb) (struct sockaddr_in * peer)); - -extern int gtp_set_cb_extheader_ind(struct gsn_t *gsn, - int (*cb) (struct sockaddr_in * peer)); - -extern int gtp_set_cb_ran_info_relay_ind(struct gsn_t *gsn, - int (*cb) (struct sockaddr_in * peer, union gtpie_member **ie)); - -extern int gtp_set_cb_conf(struct gsn_t *gsn, - int (*cb) (int type, int cause, struct pdp_t * pdp, - void *cbp)); - -int gtp_set_cb_recovery(struct gsn_t *gsn, - int (*cb) (struct sockaddr_in * peer, - uint8_t recovery)) - OSMO_DEPRECATED("Use gtp_set_cb_recovery2() instead, to obtain pdp ctx originating the recovery"); -int gtp_set_cb_recovery2(struct gsn_t *gsn, - int (*cb) (struct sockaddr_in * peer, - struct pdp_t * pdp, - uint8_t recovery)) - OSMO_DEPRECATED("Use gtp_set_cb_recovery3() instead, to obtain gsn handling the recovery"); -int gtp_set_cb_recovery3(struct gsn_t *gsn, - int (*cb) (struct gsn_t * gsn, struct sockaddr_in * peer, - struct pdp_t * pdp, - uint8_t recovery)); -void gtp_clear_queues(struct gsn_t *gsn); -extern int gtp_fd(struct gsn_t *gsn); - -extern int gtp_retrans(struct gsn_t *gsn) OSMO_DEPRECATED("This API is a no-op, libgtp already does the job internally"); -extern int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout) OSMO_DEPRECATED("This API is a no-op and will return a 1 day timeout"); - -/* Internal APIs: */ -void gtp_queue_timer_start(struct gsn_t *gsn); - -#endif /* !_GSN_H */
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/gtp.h
Deleted
@@ -1,325 +0,0 @@ -/* - * OsmoGGSN - Gateway GPRS Support Node - * Copyright (C) 2002, 2003, 2004 Mondru AB. - * - * The contents of this file may be used under the terms of the GNU - * General Public License Version 2, provided that the above copyright - * notice and this permission notice is included in all copies or - * substantial portions of the software. - * - */ - -#ifndef _GTP_H -#define _GTP_H - -#include <osmocom/core/utils.h> - -#include "gtpie.h" -#include "pdp.h" -#include "gsn.h" - -#define GTP0_PORT 3386 -#define GTP1C_PORT 2123 -#define GTP1U_PORT 2152 -#define PACKET_MAX 8196 - -#define GTP_MAX 0xffff /* TODO: Choose right number */ -#define GTP0_HEADER_SIZE 20 -#define GTP1_HEADER_SIZE_SHORT 8 -#define GTP1_HEADER_SIZE_LONG 12 - -#define NAMESIZE 1024 -#define SYSLOG_PRINTSIZE 255 -#define ERRMSG_SIZE 255 - -/* GTP version 1 extension header type definitions. */ -#define GTP_EXT_PDCP_PDU 0xC0 /* PDCP PDU Number */ - -/* GTP version 1 message type definitions. Also covers version 0 except * - * for anonymous PDP context which was superceded in version 1 */ - -/* 0 For future use. */ -#define GTP_ECHO_REQ 1 /* Echo Request */ -#define GTP_ECHO_RSP 2 /* Echo Response */ -#define GTP_NOT_SUPPORTED 3 /* Version Not Supported */ -#define GTP_ALIVE_REQ 4 /* Node Alive Request */ -#define GTP_ALIVE_RSP 5 /* Node Alive Response */ -#define GTP_REDIR_REQ 6 /* Redirection Request */ -#define GTP_REDIR_RSP 7 /* Redirection Response */ -/* 8-15 For future use. */ -#define GTP_CREATE_PDP_REQ 16 /* Create PDP Context Request */ -#define GTP_CREATE_PDP_RSP 17 /* Create PDP Context Response */ -#define GTP_UPDATE_PDP_REQ 18 /* Update PDP Context Request */ -#define GTP_UPDATE_PDP_RSP 19 /* Update PDP Context Response */ -#define GTP_DELETE_PDP_REQ 20 /* Delete PDP Context Request */ -#define GTP_DELETE_PDP_RSP 21 /* Delete PDP Context Response */ -/* 22-25 For future use. *//* In version GTP 1 anonomous PDP context */ -#define GTP_ERROR 26 /* Error Indication */ -#define GTP_PDU_NOT_REQ 27 /* PDU Notification Request */ -#define GTP_PDU_NOT_RSP 28 /* PDU Notification Response */ -#define GTP_PDU_NOT_REJ_REQ 29 /* PDU Notification Reject Request */ -#define GTP_PDU_NOT_REJ_RSP 30 /* PDU Notification Reject Response */ -#define GTP_SUPP_EXT_HEADER 31 /* Supported Extension Headers Notification */ -#define GTP_SND_ROUTE_REQ 32 /* Send Routeing Information for GPRS Request */ -#define GTP_SND_ROUTE_RSP 33 /* Send Routeing Information for GPRS Response */ -#define GTP_FAILURE_REQ 34 /* Failure Report Request */ -#define GTP_FAILURE_RSP 35 /* Failure Report Response */ -#define GTP_MS_PRESENT_REQ 36 /* Note MS GPRS Present Request */ -#define GTP_MS_PRESENT_RSP 37 /* Note MS GPRS Present Response */ -/* 38-47 For future use. */ -#define GTP_IDEN_REQ 48 /* Identification Request */ -#define GTP_IDEN_RSP 49 /* Identification Response */ -#define GTP_SGSN_CONTEXT_REQ 50 /* SGSN Context Request */ -#define GTP_SGSN_CONTEXT_RSP 51 /* SGSN Context Response */ -#define GTP_SGSN_CONTEXT_ACK 52 /* SGSN Context Acknowledge */ -#define GTP_FWD_RELOC_REQ 53 /* Forward Relocation Request */ -#define GTP_FWD_RELOC_RSP 54 /* Forward Relocation Response */ -#define GTP_FWD_RELOC_COMPL 55 /* Forward Relocation Complete */ -#define GTP_RELOC_CANCEL_REQ 56 /* Relocation Cancel Request */ -#define GTP_RELOC_CANCEL_RSP 57 /* Relocation Cancel Response */ -#define GTP_FWD_SRNS 58 /* Forward SRNS Context */ -#define GTP_FWD_RELOC_ACK 59 /* Forward Relocation Complete Acknowledge */ -#define GTP_FWD_SRNS_ACK 60 /* Forward SRNS Context Acknowledge */ -#define GTP_RAN_INFO_RELAY 70 /* RAN Information Relay */ -/* 61-239 For future use. */ -#define GTP_DATA_TRAN_REQ 240 /* Data Record Transfer Request */ -#define GTP_DATA_TRAN_RSP 241 /* Data Record Transfer Response */ -/* 242-254 For future use. */ -#define GTP_GPDU 255 /* G-PDU */ - -extern const struct value_string gtp_type_names; -static inline const char *gtp_type_name(uint8_t val) -{ return get_value_string(gtp_type_names, val); } - -/* GTP information element cause codes from 29.060 v3.9.0 7.7 */ -/* */ -#define GTPCAUSE_REQ_IMSI 0 /* Request IMSI */ -#define GTPCAUSE_REQ_IMEI 1 /* Request IMEI */ -#define GTPCAUSE_REQ_IMSI_IMEI 2 /* Request IMSI and IMEI */ -#define GTPCAUSE_NO_ID_NEEDED 3 /* No identity needed */ -#define GTPCAUSE_MS_REFUSES_X 4 /* MS refuses */ -#define GTPCAUSE_MS_NOT_RESP_X 5 /* MS is not GPRS responding */ -/* 6-48 For future use */ -/* 49-63 Cause values reserved for GPRS charging protocol use (See GTP' in GSM 12.15) */ -/* 64-127 For future use */ -#define GTPCAUSE_ACC_REQ 128 /* Request accepted */ -#define GTPCAUSE_NEW_PDP_NET_PREF 129 /* New PDP type due to network preference */ -#define GTPCAUSE_NEW_PDP_ADDR_BEAR 130 /* New PDP type due to single address bearer only */ -/* 131-176 For future use */ -/* 177-191 Cause values reserved for GPRS charging protocol use (See GTP' In GSM 12.15) */ -#define GTPCAUSE_NON_EXIST 192 /* Non-existent */ -#define GTPCAUSE_INVALID_MESSAGE 193 /* Invalid message format */ -#define GTPCAUSE_IMSI_NOT_KNOWN 194 /* IMSI not known */ -#define GTPCAUSE_MS_DETACHED 195 /* MS is GPRS detached */ -#define GTPCAUSE_MS_NOT_RESP 196 /* MS is not GPRS responding */ -#define GTPCAUSE_MS_REFUSES 197 /* MS refuses */ -/* 198 For future use */ -#define GTPCAUSE_NO_RESOURCES 199 /* No resources available */ -#define GTPCAUSE_NOT_SUPPORTED 200 /* Service not supported */ -#define GTPCAUSE_MAN_IE_INCORRECT 201 /* Mandatory IE incorrect */ -#define GTPCAUSE_MAN_IE_MISSING 202 /* Mandatory IE missing */ -#define GTPCAUSE_OPT_IE_INCORRECT 203 /* Optional IE incorrect */ -#define GTPCAUSE_SYS_FAIL 204 /* System failure */ -#define GTPCAUSE_ROAMING_REST 205 /* Roaming Restriction */ -#define GTPCAUSE_PTIMSI_MISMATCH 206 /* P-TMSI signature mismatch */ -#define GTPCAUSE_CONN_SUSP 207 /* GPRS connection suspended */ -#define GTPCAUSE_AUTH_FAIL 208 /* Authentication failure */ -#define GTPCAUSE_USER_AUTH_FAIL 209 /* User authentication failed */ -#define GTPCAUSE_CONTEXT_NOT_FOUND 210 /* Context not found */ -#define GTPCAUSE_ADDR_OCCUPIED 211 /* All dynamic PDP addresses are occupied */ -#define GTPCAUSE_NO_MEMORY 212 /* No memory is available */ -#define GTPCAUSE_RELOC_FAIL 213 /* Relocation failure */ -#define GTPCAUSE_UNKNOWN_MAN_EXTHEADER 214 /* Unknown mandatory extension header */ -#define GTPCAUSE_SEM_ERR_TFT 215 /* Semantic error in the TFT operation */ -#define GTPCAUSE_SYN_ERR_TFT 216 /* Syntactic error in the TFT operation */ -#define GTPCAUSE_SEM_ERR_FILTER 217 /* Semantic errors in packet filter(s) */ -#define GTPCAUSE_SYN_ERR_FILTER 218 /* Syntactic errors in packet filter(s) */ -#define GTPCAUSE_MISSING_APN 219 /* Missing or unknown APN */ -#define GTPCAUSE_UNKNOWN_PDP 220 /* Unknown PDP address or PDP type */ -/* 221-240 For future use */ -/* 241-255 Cause Values Reserved For Gprs Charging Protocol Use (See Gtp' In Gsm 12.15) */ - -static inline bool gtp_cause_successful(uint8_t cause) -{ - return cause == GTPCAUSE_ACC_REQ || - cause == GTPCAUSE_NEW_PDP_NET_PREF || - cause == GTPCAUSE_NEW_PDP_ADDR_BEAR; -} - -struct ul66_t; -struct ul16_t; -struct pdp_t; - -/* GTP 0 header. - * Explanation to some of the fields: - * SNDCP NPDU Number flag = 0 except for inter SGSN handover situations - * SNDCP N-PDU LCC Number 0 = 0xff except for inter SGSN handover situations - * Sequence number. Used for reliable delivery of signalling messages, and - * to discard "illegal" data messages. - * Flow label. Is used to point a particular PDP context. Is used in data - * messages as well as signalling messages related to a particular context. - * Tunnel ID is IMSI+NSAPI. Unique identifier of PDP context. Is somewhat - * redundant because the header also includes flow. */ - -struct gtp0_header { /* Descriptions from 3GPP 09.60 */ - uint8_t flags; /* 01 bitfield, with typical values */ - /* 000..... Version: 1 (0) */ - /* ...1111. Spare (7) */ - /* .......0 SNDCP N-PDU Number flag (0) */ - uint8_t type; /* 02 Message type. T-PDU = 0xff */ - uint16_t length; /* 03 Length (of G-PDU excluding header) */ - uint16_t seq; /* 05 Sequence Number */ - uint16_t flow; /* 07 Flow Label ( = 0 for signalling) */ - uint8_t number; /* 09 SNDCP N-PDU LCC Number ( 0 = 0xff) */ - uint8_t spare1; /* 10 Spare */ - uint8_t spare2; /* 11 Spare */ - uint8_t spare3; /* 12 Spare */ - uint64_t tid; /* 13 Tunnel ID */ -} __attribute__((packed)); /* 20 */ - -#define GTP1HDR_F_NPDU 0x01 -#define GTP1HDR_F_SEQ 0x02 -#define GTP1HDR_F_EXT 0x04 -#define GTP1HDR_F_GTP1 0x10 -#define GTPHDR_F_VER(n) ((n) << 5) -#define GTPHDR_F_GET_VER(flags) ((flags)>>5) - -struct gtp1_header_short { /* Descriptions from 3GPP 29060 */ - uint8_t flags; /* 01 bitfield, with typical values */ - /* 001..... Version: 1 */ - /* ...1.... Protocol Type: GTP=1, GTP'=0 */ - /* ....0... Spare = 0 */ - /* .....0.. Extension header flag: 0 */ - /* ......0. Sequence number flag: 0 */ - /* .......0 PN: N-PDU Number flag */ - uint8_t type; /* 02 Message type. T-PDU = 0xff */ - uint16_t length; /* 03 Length (of IP packet or signalling) */ - uint32_t tei; /* 05 - 08 Tunnel Endpoint ID */ -} __attribute__((packed)); -
View file
osmo-ggsn_1.11.0.19.3372.202405152026.dsc -> osmo-ggsn_1.11.0.30.5758.202405162026.dsc
Changed
@@ -2,7 +2,7 @@ Source: osmo-ggsn Binary: osmo-ggsn, libgtp6, gtp-echo-responder, libgtp-dev, osmo-ggsn-dbg, gtp-echo-responder-dbg, libgtp-dbg, osmo-ggsn-doc Architecture: any all -Version: 1.11.0.19.3372.202405152026 +Version: 1.11.0.30.5758.202405162026 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/openggsn Standards-Version: 3.9.6 @@ -19,8 +19,8 @@ osmo-ggsn-dbg deb debug extra arch=any osmo-ggsn-doc deb doc optional arch=all Checksums-Sha1: - 50becf8badef9e272c01fe9d9ada7cb53c010fd0 185708 osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz + ad9bb10b35e543e449fff3d500bd2e30dcc6a7da 182700 osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz Checksums-Sha256: - 51b690c2bf4a5ae155468158b11f7bf5aea0176afa042f7855c1c842dfa004c3 185708 osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz + 82ebc198567207a895b98beecf770cedb926021440e8c3a9767937a504efb3fb 182700 osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz Files: - 339fc77e7c753c0bb0bde5a78e2af2ea 185708 osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz + 6034556d4cb0ff60ebe0d470fcd32275 182700 osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/.tarball-version -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.11.0.19-3372.202405152026 +1.11.0.30-5758.202405162026
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/Makefile.am -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/Makefile.am
Changed
@@ -1,5 +1,6 @@ ## Process this file with automake to produce Makefile.in SUBDIRS = \ + include \ lib \ gtp \ ggsn \
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/TODO-RELEASE -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/TODO-RELEASE
Changed
@@ -8,4 +8,5 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libgtp REMOVE remove GTP cause defines of reserved values +libgtp REMOVE ABI change (removed API: ipv42eua, eua2ipv4) libgtpnl > 1.2.5 gtp_tunnel_set_family()
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/configure.ac -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/configure.ac
Changed
@@ -265,6 +265,9 @@ tests/Makefile tests/lib/Makefile tests/gtp/Makefile + include/Makefile + include/osmocom/Makefile + include/osmocom/gtp/Makefile libgtp.pc) AC_OUTPUT
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/contrib/systemd/osmo-ggsn.service -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/contrib/systemd/osmo-ggsn.service
Changed
@@ -11,6 +11,10 @@ ExecStart=/usr/bin/osmo-ggsn -c /etc/osmocom/osmo-ggsn.cfg RestartSec=2 RestartPreventExitStatus=1 +User=osmocom +Group=osmocom +# For setting up the gtp0/tun0 devices +AmbientCapabilities=CAP_NET_ADMIN Install WantedBy=multi-user.target
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/debian/changelog -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-ggsn (1.11.0.19.3372.202405152026) unstable; urgency=medium +osmo-ggsn (1.11.0.30.5758.202405162026) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom nightly feed - -- Osmocom OBS scripts <info@osmocom.org> Wed, 15 May 2024 20:26:45 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Thu, 16 May 2024 20:26:44 +0000 osmo-ggsn (1.11.0) unstable; urgency=medium
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/debian/control -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/debian/control
Changed
@@ -17,7 +17,7 @@ Package: osmo-ggsn Architecture: any -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends} Description: Osmocom Gateway GPRS Support Node (GGSN) OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile @@ -28,7 +28,7 @@ Architecture: any Multi-Arch: same Section: libs -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends} Description: library implementing the GTP protocol between SGSN and GGSN OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile @@ -40,7 +40,7 @@ Package: gtp-echo-responder Architecture: any -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends} Description: Small program answering GTP ECHO Request with GTP ECHO Response @@ -48,7 +48,7 @@ Architecture: any Multi-Arch: same Section: libdevel -Depends: osmocom-nightly (= 202405152026), ${misc:Depends}, +Depends: osmocom-nightly (= 202405162026), ${misc:Depends}, libgtp6 (= ${binary:Version}) Description: Development files for libgtp OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile @@ -62,7 +62,7 @@ Section: debug Architecture: any Priority: extra -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, ${misc:Depends}, libgtp6 (= ${binary:Version}), osmo-ggsn (= ${binary:Version}) +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends}, libgtp6 (= ${binary:Version}), osmo-ggsn (= ${binary:Version}) Multi-Arch: same Description: Debug symbols for OsmoGGSN OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile @@ -73,7 +73,7 @@ Section: debug Architecture: any Priority: extra -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, ${misc:Depends}, gtp-echo-responder (= ${binary:Version}) +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends}, gtp-echo-responder (= ${binary:Version}) Multi-Arch: same Description: Debug symbols for gtp-echo-responder Small program answering GTP ECHO Request with GTP ECHO Response. @@ -82,7 +82,7 @@ Section: debug Architecture: any Priority: extra -Depends: osmocom-nightly (= 202405152026), ${shlibs:Depends}, ${misc:Depends}, libgtp6 (= ${binary:Version}) +Depends: osmocom-nightly (= 202405162026), ${shlibs:Depends}, ${misc:Depends}, libgtp6 (= ${binary:Version}) Multi-Arch: same Description: Debug symbols for OsmoGGSN OsmoGGSN is a Gateway GPRS Support Node (GGSN). It is used by mobile @@ -96,7 +96,7 @@ Architecture: all Section: doc Priority: optional -Depends: osmocom-nightly (= 202405152026), ${misc:Depends} +Depends: osmocom-nightly (= 202405162026), ${misc:Depends} Description: ${misc:Package} PDF documentation Various manuals: user manual, VTY reference manual and/or protocol/interface manuals.
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/debian/postinst
Added
@@ -0,0 +1,39 @@ +#!/bin/sh -e +case "$1" in + configure) + # Create the osmocom group and user (if it doesn't exist yet) + if ! getent group osmocom >/dev/null; then + groupadd --system osmocom + fi + if ! getent passwd osmocom >/dev/null; then + useradd \ + --system \ + --gid osmocom \ + --home-dir /var/lib/osmocom \ + --shell /sbin/nologin \ + --comment "Open Source Mobile Communications" \ + osmocom + fi + + # Fix permissions of previous (root-owned) install (OS#4107) + if dpkg --compare-versions "$2" le "1.13.0"; then + if -e /etc/osmocom/osmo-ggsn.cfg ; then + chown -v osmocom:osmocom /etc/osmocom/osmo-ggsn.cfg + chmod -v 0660 /etc/osmocom/osmo-ggsn.cfg + fi + + if -d /etc/osmocom ; then + chown -v root:osmocom /etc/osmocom + chmod -v 2775 /etc/osmocom + fi + + mkdir -p /var/lib/osmocom + chown -R -v osmocom:osmocom /var/lib/osmocom + fi + ;; +esac + +# dh_installdeb(1) will replace this with shell code automatically +# generated by other debhelper scripts. +#DEBHELPER# +
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/doc/examples/osmo-ggsn-kernel-gtp.cfg -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/doc/examples/osmo-ggsn-kernel-gtp.cfg
Changed
@@ -3,10 +3,12 @@ !! ! log stderr - logging filter all 1 logging color 1 - logging print category 0 + logging print category-hex 0 + logging print category 1 logging timestamp 0 + logging print file basename last + logging print level 1 logging level ip info logging level tun info logging level ggsn info @@ -36,7 +38,7 @@ no login ! ggsn ggsn0 - gtp state-dir /tmp + gtp state-dir /var/lib/osmocom/osmo-ggsn gtp bind-ip 127.0.0.2 apn internet gtpu-mode kernel-gtp
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/doc/examples/osmo-ggsn.cfg -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/doc/examples/osmo-ggsn.cfg
Changed
@@ -3,10 +3,12 @@ !! ! log stderr - logging filter all 1 logging color 1 - logging print category 0 + logging print category-hex 0 + logging print category 1 logging timestamp 0 + logging print file basename last + logging print level 1 logging level ip info logging level tun info logging level ggsn info @@ -36,7 +38,7 @@ no login ! ggsn ggsn0 - gtp state-dir /tmp + gtp state-dir /var/lib/osmocom/osmo-ggsn gtp bind-ip 127.0.0.2 apn internet gtpu-mode tun
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/doc/manuals/chapters/configuration.adoc -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/doc/manuals/chapters/configuration.adoc
Changed
@@ -16,7 +16,7 @@ .Example: Single GGSN configuration section ---- ggsn ggsn0 - gtp state-dir /tmp + gtp state-dir /var/lib/osmocom/osmo-ggsn gtp bind-ip 127.0.0.6 apn internet gtpu-mode tun @@ -58,7 +58,7 @@ for every GGSN instance: ---- -OsmoGGSN(config-ggsn)# gtp state-dir /var/lib/ggsn/ggsn0 <1> +OsmoGGSN(config-ggsn)# gtp state-dir /var/lib/osmocom/osmo-ggsn <1> OsmoGGSN(config-ggsn)# gtp bind-ip 127.0.0.6 <2> ---- <1> Store the GSN restart state in the specified directory
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/Makefile.am -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/Makefile.am
Changed
@@ -7,6 +7,7 @@ -fno-builtin \ -Wall \ -DSBINDIR='"$(sbindir)"' \ + -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/ggsn.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/ggsn.c
Changed
@@ -46,17 +46,19 @@ #include <osmocom/ctrl/control_if.h> #include <osmocom/gsm/apn.h> +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> + #include "../lib/tun.h" #include "../lib/ippool.h" #include "../lib/syserr.h" #include "../lib/in46_addr.h" #include "../lib/gtp-kernel.h" #include "../lib/util.h" -#include "../gtp/pdp.h" -#include "../gtp/gtp.h" #include "../lib/icmpv6.h" #include "pco.h" #include "ggsn.h" +#include "../gtp/gtp_internal.h" static int ggsn_tun_fd_cb(struct osmo_fd *fd, unsigned int what); static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len);
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/ggsn.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/ggsn.h
Changed
@@ -8,12 +8,12 @@ #include <osmocom/core/timer.h> #include <osmocom/core/tdef.h> #include <osmocom/ctrl/control_if.h> +#include <osmocom/gtp/gtp.h> #include "../lib/tun.h" #include "../lib/ippool.h" #include "../lib/syserr.h" #include "../lib/in46_addr.h" -#include "../gtp/gtp.h" #include "sgsn.h"
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/ggsn_vty.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/ggsn_vty.c
Changed
@@ -22,6 +22,8 @@ #include <inttypes.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/stat.h> +#include <sys/types.h> #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h> @@ -35,13 +37,14 @@ #include <osmocom/vty/misc.h> #include <osmocom/vty/tdef_vty.h> -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include <osmocom/gtp/gtp.h> +#include <osmocom/gtp/pdp.h> #include "../lib/util.h" #include "ggsn.h" #include "sgsn.h" +#include "../gtp/gtp_internal.h" #define PREFIX_STR "Prefix (Network/Netmask)\n" #define IFCONFIG_STR "GGSN-based interface configuration\n" @@ -223,6 +226,11 @@ { struct ggsn_ctx *ggsn = (struct ggsn_ctx *) vty->index; + if (mkdir(argv0, 0755) == -1 && errno != EEXIST) { + vty_out(vty, "%% Failed to create state-dir: %s%s", argv0, VTY_NEWLINE); + return CMD_WARNING; + } + osmo_talloc_replace_string(ggsn, &ggsn->cfg.state_dir, argv0); return CMD_SUCCESS;
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/pco.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/pco.h
Changed
@@ -2,7 +2,7 @@ #include <stdint.h> -#include "../gtp/pdp.h" +#include <osmocom/gtp/pdp.h> /* 3GPP TS 24.008 10.5.6.3 */ enum pco_protocols {
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/sgsn.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/sgsn.c
Changed
@@ -1,6 +1,6 @@ #include "sgsn.h" #include "ggsn.h" - +#include "../gtp/gtp_internal.h" static bool sgsn_peer_attempt_free(struct sgsn_peer *sgsn) {
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/ggsn/sgsn.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/ggsn/sgsn.h
Changed
@@ -8,7 +8,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/timer.h> -#include "../gtp/pdp.h" +#include <osmocom/gtp/pdp.h> struct ggsn_ctx; struct pdp_priv_t;
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/Makefile.am -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/Makefile.am
Changed
@@ -6,26 +6,23 @@ lib_LTLIBRARIES = libgtp.la -include_HEADERS = gtp.h gsn.h pdp.h gtpie.h - AM_CFLAGS = \ -fno-builtin \ -Wall \ -DSBINDIR='"$(sbindir)"' \ + -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ $(NULL) libgtp_la_SOURCES = \ gsn.c \ - gsn.h \ + gsn_internal.h \ gtp.c \ - gtp.h \ + gtp_internal.h \ gtpie.c \ - gtpie.h \ lookupa.c \ lookupa.h \ pdp.c \ - pdp.h \ queue.c \ queue.h \ $(NULL)
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/gsn.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/gsn.c
Changed
@@ -57,10 +57,12 @@ /* #include <stdint.h> ISO C99 types */ -#include "pdp.h" -#include "gtp.h" -#include "gtpie.h" +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> +#include <osmocom/gtp/gtpie.h> + #include "queue.h" +#include "gsn_internal.h" /* Error reporting functions */
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/gsn_internal.h
Added
@@ -0,0 +1,3 @@ +#pragma once + +void gtp_queue_timer_start(struct gsn_t *gsn);
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/gtp.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/gtp.c
Changed
@@ -55,10 +55,13 @@ /* #include <stdint.h> ISO C99 types */ -#include "pdp.h" -#include "gtp.h" -#include "gtpie.h" +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> +#include <osmocom/gtp/gtpie.h> + #include "queue.h" +#include "gsn_internal.h" +#include "gtp_internal.h" /* Error reporting functions */ @@ -638,8 +641,8 @@ } /* Send off an echo reply */ -int gtp_echo_resp(struct gsn_t *gsn, int version, - struct sockaddr_in *peer, int fd, void *pack, unsigned len) +static int gtp_echo_resp(struct gsn_t *gsn, int version, + struct sockaddr_in *peer, int fd, void *pack, unsigned len) { union gtp_packet packet; unsigned int length = get_default_gtp(version, GTP_ECHO_RSP, &packet); @@ -650,8 +653,8 @@ } /* Handle a received echo request */ -int gtp_echo_ind(struct gsn_t *gsn, int version, struct sockaddr_in *peer, - int fd, void *pack, unsigned len) +static int gtp_echo_ind(struct gsn_t *gsn, int version, struct sockaddr_in *peer, + int fd, void *pack, unsigned len) { /* Check if it was a duplicate request */ @@ -663,8 +666,8 @@ } /* Handle a received echo reply */ -int gtp_echo_conf(struct gsn_t *gsn, int version, struct sockaddr_in *peer, - void *pack, unsigned len) +static int gtp_echo_conf(struct gsn_t *gsn, int version, struct sockaddr_in *peer, + void *pack, unsigned len) { union gtpie_member *ieGTPIE_SIZE; unsigned char recovery; @@ -716,8 +719,8 @@ * only listen to the GTP0 port, and therefore will never receive * anything else than GTP0 */ -int gtp_unsup_req(struct gsn_t *gsn, int version, struct sockaddr_in *peer, - int fd, void *pack, unsigned len) +static int gtp_unsup_req(struct gsn_t *gsn, int version, struct sockaddr_in *peer, + int fd, void *pack, unsigned len) { union gtp_packet packet; @@ -727,8 +730,8 @@ } /* Handle a Version Not Supported message */ -int gtp_unsup_ind(struct gsn_t *gsn, struct sockaddr_in *peer, - void *pack, unsigned len) +static int gtp_unsup_ind(struct gsn_t *gsn, struct sockaddr_in *peer, + void *pack, unsigned len) { if (gsn->cb_unsup_ind) @@ -821,6 +824,40 @@ } /* *********************************************************** + * Conversion functions + *************************************************************/ + +/* *********************************************************** + * IP address conversion functions + * There exist several types of address representations: + * - eua: End User Address. (29.060, 7.7.27, message type 128) + * Used for signalling address to mobile station. Supports IPv4 + * IPv6 x.25 etc. etc. + * - gsna: GSN Address. (29.060, 7.7.32, message type 133): IP address + * of GSN. If length is 4 it is IPv4. If length is 16 it is IPv6. + * - in_addr: IPv4 address struct. + * - sockaddr_in: Socket API representation of IP address and + * port number. + *************************************************************/ + +int gsna2in_addr(struct in_addr *dst, struct ul16_t *gsna) +{ + memset(dst, 0, sizeof(struct in_addr)); + if (gsna->l != 4) + return EOF; /* Return if not IPv4 */ + memcpy(dst, gsna->v, gsna->l); + return 0; +} + +static int in_addr2gsna(struct ul16_t *gsna, struct in_addr *src) +{ + memset(gsna, 0, sizeof(struct ul16_t)); + gsna->l = 4; + memcpy(gsna->v, src, gsna->l); + return 0; +} + +/* *********************************************************** * Session management messages * Messages: create, update and delete PDP context * @@ -988,22 +1025,9 @@ return 0; } -/* API: Application response to context indication */ -int gtp_create_context_resp(struct gsn_t *gsn, struct pdp_t *pdp, int cause) -{ - - /* Now send off a reply to the peer */ - gtp_create_pdp_resp(gsn, pdp->version, pdp, cause); - - if (!gtp_cause_successful(cause)) - gtp_freepdp(gsn, pdp); - - return 0; -} - /* Send Create PDP Context Response */ -int gtp_create_pdp_resp(struct gsn_t *gsn, int version, struct pdp_t *pdp, - uint8_t cause) +static int gtp_create_pdp_resp(struct gsn_t *gsn, int version, struct pdp_t *pdp, + uint8_t cause) { union gtp_packet packet; unsigned int length = @@ -1064,10 +1088,23 @@ pdp->fd, pdp->seq, pdp->tid); } +/* API: Application response to context indication */ +int gtp_create_context_resp(struct gsn_t *gsn, struct pdp_t *pdp, int cause) +{ + + /* Now send off a reply to the peer */ + gtp_create_pdp_resp(gsn, pdp->version, pdp, cause); + + if (!gtp_cause_successful(cause)) + gtp_freepdp(gsn, pdp); + + return 0; +} + /* Handle Create PDP Context Request */ -int gtp_create_pdp_ind(struct gsn_t *gsn, int version, - struct sockaddr_in *peer, int fd, - void *pack, unsigned len) +static int gtp_create_pdp_ind(struct gsn_t *gsn, int version, + struct sockaddr_in *peer, int fd, + void *pack, unsigned len) { struct pdp_t *pdp, *pdp_old; struct pdp_t pdp_buf; @@ -1390,8 +1427,8 @@ } /* Handle Create PDP Context Response */ -int gtp_create_pdp_conf(struct gsn_t *gsn, int version, - struct sockaddr_in *peer, void *pack, unsigned len) +static int gtp_create_pdp_conf(struct gsn_t *gsn, int version, + struct sockaddr_in *peer, void *pack, unsigned len) { struct pdp_t *pdp; union gtpie_member *ieGTPIE_SIZE; @@ -2157,11 +2194,11 @@ } /* Send Delete PDP Context Response */ -int gtp_delete_pdp_resp(struct gsn_t *gsn, int version, - struct sockaddr_in *peer, int fd, - void *pack, unsigned len, - struct pdp_t *pdp, struct pdp_t *linked_pdp, - uint8_t cause, int teardown) +static int gtp_delete_pdp_resp(struct gsn_t *gsn, int version, + struct sockaddr_in *peer, int fd, + void *pack, unsigned len, + struct pdp_t *pdp, struct pdp_t *linked_pdp, + uint8_t cause, int teardown) { union gtp_packet packet; unsigned int length = @@ -2202,9 +2239,9 @@ } /* Handle Delete PDP Context Request */ -int gtp_delete_pdp_ind(struct gsn_t *gsn, int version, - struct sockaddr_in *peer, int fd, - void *pack, unsigned len)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/gtp_internal.h
Added
@@ -0,0 +1,3 @@ +#pragma once + +uint64_t gtp_imsi_str2gtp(const char *str);
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/gtpie.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/gtpie.c
Changed
@@ -37,7 +37,7 @@ #include <netinet/in.h> #include <string.h> -#include "gtpie.h" +#include <osmocom/gtp/gtpie.h> /*! Encode a TLV type Information Element. * \paraminout p Pointer to output packet to which IE is appended
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/pdp.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/pdp.c
Changed
@@ -28,8 +28,10 @@ #include <netinet/in.h> #include <string.h> #include <inttypes.h> -#include "pdp.h" -#include "gtp.h" + +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> + #include "lookupa.h" #include "queue.h"
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/queue.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/queue.c
Changed
@@ -27,8 +27,10 @@ #include <sys/time.h> #include <netinet/in.h> #include <string.h> -#include "pdp.h" -#include "gtp.h" + +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> + #include "queue.h" /*! \brief dump a queue_t to stdout */
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/gtp/queue.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/gtp/queue.h
Changed
@@ -19,7 +19,7 @@ #include <osmocom/core/linuxlist.h> -#include "gtp.h" +#include <osmocom/gtp/gtp.h> #define QUEUE_DEBUG 0 /* Print debug information */
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include
Added
+(directory)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/Makefile.am
Added
@@ -0,0 +1,3 @@ +SUBDIRS = \ + osmocom \ + $(NULL)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom
Added
+(directory)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/Makefile.am
Added
@@ -0,0 +1,3 @@ +SUBDIRS = \ + gtp \ + $(NULL)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp
Added
+(directory)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp/Makefile.am
Added
@@ -0,0 +1,8 @@ +libgtp_HEADERS = \ + gsn.h \ + gtp.h \ + gtpie.h \ + pdp.h \ + $(NULL) + +libgtpdir = $(includedir)/osmocom/gtp
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp/gsn.h
Added
@@ -0,0 +1,178 @@ +/* + * OsmoGGSN - Gateway GPRS Support Node + * Copyright (C) 2002, 2003, 2004 Mondru AB. + * + * The contents of this file may be used under the terms of the GNU + * General Public License Version 2, provided that the above copyright + * notice and this permission notice is included in all copies or + * substantial portions of the software. + * + */ + +#ifndef _GSN_H +#define _GSN_H + +#include <osmocom/core/utils.h> +#include <osmocom/core/defs.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/tdef.h> +#include <osmocom/core/rate_ctr.h> + +#include "pdp.h" + +#define GTP_MODE_GGSN 1 +#define GTP_MODE_SGSN 2 + +#define RESTART_FILE "gsn_restart" + +extern struct osmo_tdef gtp_T_defs; + +/* *********************************************************** + * Information storage for each gsn instance + * + * Normally each instance of the application corresponds to + * one instance of a gsn. + * + * In order to avoid global variables in the application, and + * also in order to allow several instances of a gsn in the same + * application this struct is provided in order to store all + * relevant information related to the gsn. + * + * Note that this does not include information storage for ' + * each pdp context. This is stored in another struct. + *************************************************************/ + +enum gsn_rate_ctr_keys { + GSN_CTR_ERR_SOCKET, + GSN_CTR_ERR_READFROM, /* Number of readfrom errors */ + GSN_CTR_ERR_SENDTO, /* Number of sendto errors */ + GSN_CTR_ERR_QUEUEFULL, /* Number of times queue was full */ + GSN_CTR_ERR_SEQ, /* Number of seq out of range */ + GSN_CTR_ERR_ADDRESS, /* GSN address conversion failed */ + GSN_CTR_ERR_UNKNOWN_PDP, /* GSN address conversion failed */ + GSN_CTR_ERR_UNEXPECTED_CAUSE, /* Unexpected cause value received */ + GSN_CTR_ERR_OUT_OF_PDP, /* Out of storage for PDP contexts */ + GSN_CTR_PKT_EMPTY, /* Number of empty packets */ + GSN_CTR_PKT_UNSUP, /* Number of unsupported version 29.60 11.1.1 */ + GSN_CTR_PKT_TOOSHORT, /* Number of too short headers 29.60 11.1.2 */ + GSN_CTR_PKT_UNKNOWN, /* Number of unknown messages 29.60 11.1.3 */ + GSN_CTR_PKT_UNEXPECT, /* Number of unexpected messages 29.60 11.1.4 */ + GSN_CTR_PKT_DUPLICATE, /* Number of duplicate or unsolicited replies */ + GSN_CTR_PKT_MISSING, /* Number of missing information field messages */ + GSN_CTR_PKT_INCORRECT, /* Number of incorrect information field messages */ + GSN_CTR_PKT_INVALID, /* Number of invalid message format messages */ +}; + +/* 3GPP TS 29.006 14.1, 14,2 */ +enum gtp_gsn_timers { + GTP_GSN_TIMER_T3_RESPONSE = 3, + GTP_GSN_TIMER_N3_REQUESTS = 1003, + GTP_GSN_TIMER_T3_HOLD_RESPONSE = -3, +}; + +struct gsn_t { + /* Parameters related to the network interface */ + + int fd0; /* GTP0 file descriptor */ + int fd1c; /* GTP1 control plane file descriptor */ + int fd1u; /* GTP0 user plane file descriptor */ + int mode; /* Mode of operation: GGSN or SGSN */ + struct in_addr gsnc; /* IP address of this gsn for signalling */ + struct in_addr gsnu; /* IP address of this gsn for user traffic */ + + /* Parameters related to signalling messages */ + uint16_t seq_next; /* Next sequence number to use */ + int seq_first; /* First packet in queue (oldest timeout) */ + int seq_last; /* Last packet in queue (youngest timeout) */ + + unsigned char restart_counter; /* Increment on restart. Stored on disk */ + char *statedir; /* Disk location for permanent storage */ + void *priv; /* used by libgtp users to attach their own state) */ + struct queue_t *queue_req; /* Request queue */ + struct queue_t *queue_resp; /* Response queue */ + + struct pdp_t pdpaPDP_MAX; /* PDP storage */ + struct pdp_t *hashtidPDP_MAX; /* Hash table for IMSI + NSAPI */ + + struct osmo_timer_list queue_timer; /* internal queue_{req,resp} timer */ + + /* Call back functions */ + int (*cb_delete_context) (struct pdp_t *); + int (*cb_create_context_ind) (struct pdp_t *); + int (*cb_unsup_ind) (struct sockaddr_in * peer); + int (*cb_extheader_ind) (struct sockaddr_in * peer); + int (*cb_ran_info_relay_ind) (struct sockaddr_in *peer, union gtpie_member **ie); + int (*cb_conf) (int type, int cause, struct pdp_t * pdp, void *cbp); + int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len); + int (*cb_recovery) (struct sockaddr_in * peer, uint8_t recovery); + int (*cb_recovery2) (struct sockaddr_in * peer, struct pdp_t * pdp, uint8_t recovery); + int (*cb_recovery3) (struct gsn_t *gsn, struct sockaddr_in *peer, struct pdp_t *pdp, uint8_t recovery); + + /* Counters */ + struct rate_ctr_group *ctrg; + + /* Timers: */ + struct osmo_tdef *tdef; +}; + +/* External API functions */ + +extern int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen, + int mode); + +extern int gtp_free(struct gsn_t *gsn); + +extern int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp, + uint64_t imsi, uint8_t nsapi) OSMO_DEPRECATED("Use gtp_pdp_newpdp() instead"); +extern int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp); +extern int gtp_freepdp_teardown(struct gsn_t *gsn, struct pdp_t *pdp); + +extern int gtp_create_context_req(struct gsn_t *gsn, struct pdp_t *pdp, + void *cbp); + +extern int gtp_set_cb_create_context_ind(struct gsn_t *gsn, + int (*cb_create_context_ind) (struct + pdp_t * + pdp)); +extern int gtp_set_cb_data_ind(struct gsn_t *gsn, + int (*cb_data_ind) (struct pdp_t * pdp, + void *pack, unsigned len)); +extern int gtp_set_cb_delete_context(struct gsn_t *gsn, + int (*cb_delete_context) (struct pdp_t * + pdp)); +/*extern int gtp_set_cb_create_context(struct gsn_t *gsn, + int (*cb_create_context) (struct pdp_t* pdp)); */ + +extern int gtp_set_cb_unsup_ind(struct gsn_t *gsn, + int (*cb) (struct sockaddr_in * peer)); + +extern int gtp_set_cb_extheader_ind(struct gsn_t *gsn, + int (*cb) (struct sockaddr_in * peer)); + +extern int gtp_set_cb_ran_info_relay_ind(struct gsn_t *gsn, + int (*cb) (struct sockaddr_in * peer, union gtpie_member **ie)); + +extern int gtp_set_cb_conf(struct gsn_t *gsn, + int (*cb) (int type, int cause, struct pdp_t * pdp, + void *cbp)); + +int gtp_set_cb_recovery(struct gsn_t *gsn, + int (*cb) (struct sockaddr_in * peer, + uint8_t recovery)) + OSMO_DEPRECATED("Use gtp_set_cb_recovery2() instead, to obtain pdp ctx originating the recovery"); +int gtp_set_cb_recovery2(struct gsn_t *gsn, + int (*cb) (struct sockaddr_in * peer, + struct pdp_t * pdp, + uint8_t recovery)) + OSMO_DEPRECATED("Use gtp_set_cb_recovery3() instead, to obtain gsn handling the recovery"); +int gtp_set_cb_recovery3(struct gsn_t *gsn, + int (*cb) (struct gsn_t * gsn, struct sockaddr_in * peer, + struct pdp_t * pdp, + uint8_t recovery)); +void gtp_clear_queues(struct gsn_t *gsn); +extern int gtp_fd(struct gsn_t *gsn); + +extern int gtp_retrans(struct gsn_t *gsn) OSMO_DEPRECATED("This API is a no-op, libgtp already does the job internally"); +extern int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout) OSMO_DEPRECATED("This API is a no-op and will return a 1 day timeout"); + +#endif /* !_GSN_H */
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp/gtp.h
Added
@@ -0,0 +1,276 @@ +/* + * OsmoGGSN - Gateway GPRS Support Node + * Copyright (C) 2002, 2003, 2004 Mondru AB. + * + * The contents of this file may be used under the terms of the GNU + * General Public License Version 2, provided that the above copyright + * notice and this permission notice is included in all copies or + * substantial portions of the software. + * + */ + +#ifndef _GTP_H +#define _GTP_H + +#include <osmocom/core/utils.h> + +#include "gtpie.h" +#include "pdp.h" +#include "gsn.h" + +#define GTP0_PORT 3386 +#define GTP1C_PORT 2123 +#define GTP1U_PORT 2152 +#define PACKET_MAX 8196 + +#define GTP_MAX 0xffff /* TODO: Choose right number */ +#define GTP0_HEADER_SIZE 20 +#define GTP1_HEADER_SIZE_SHORT 8 +#define GTP1_HEADER_SIZE_LONG 12 + +#define NAMESIZE 1024 +#define SYSLOG_PRINTSIZE 255 +#define ERRMSG_SIZE 255 + +/* GTP version 1 extension header type definitions. */ +#define GTP_EXT_PDCP_PDU 0xC0 /* PDCP PDU Number */ + +/* GTP version 1 message type definitions. Also covers version 0 except * + * for anonymous PDP context which was superceded in version 1 */ + +/* 0 For future use. */ +#define GTP_ECHO_REQ 1 /* Echo Request */ +#define GTP_ECHO_RSP 2 /* Echo Response */ +#define GTP_NOT_SUPPORTED 3 /* Version Not Supported */ +#define GTP_ALIVE_REQ 4 /* Node Alive Request */ +#define GTP_ALIVE_RSP 5 /* Node Alive Response */ +#define GTP_REDIR_REQ 6 /* Redirection Request */ +#define GTP_REDIR_RSP 7 /* Redirection Response */ +/* 8-15 For future use. */ +#define GTP_CREATE_PDP_REQ 16 /* Create PDP Context Request */ +#define GTP_CREATE_PDP_RSP 17 /* Create PDP Context Response */ +#define GTP_UPDATE_PDP_REQ 18 /* Update PDP Context Request */ +#define GTP_UPDATE_PDP_RSP 19 /* Update PDP Context Response */ +#define GTP_DELETE_PDP_REQ 20 /* Delete PDP Context Request */ +#define GTP_DELETE_PDP_RSP 21 /* Delete PDP Context Response */ +/* 22-25 For future use. *//* In version GTP 1 anonomous PDP context */ +#define GTP_ERROR 26 /* Error Indication */ +#define GTP_PDU_NOT_REQ 27 /* PDU Notification Request */ +#define GTP_PDU_NOT_RSP 28 /* PDU Notification Response */ +#define GTP_PDU_NOT_REJ_REQ 29 /* PDU Notification Reject Request */ +#define GTP_PDU_NOT_REJ_RSP 30 /* PDU Notification Reject Response */ +#define GTP_SUPP_EXT_HEADER 31 /* Supported Extension Headers Notification */ +#define GTP_SND_ROUTE_REQ 32 /* Send Routeing Information for GPRS Request */ +#define GTP_SND_ROUTE_RSP 33 /* Send Routeing Information for GPRS Response */ +#define GTP_FAILURE_REQ 34 /* Failure Report Request */ +#define GTP_FAILURE_RSP 35 /* Failure Report Response */ +#define GTP_MS_PRESENT_REQ 36 /* Note MS GPRS Present Request */ +#define GTP_MS_PRESENT_RSP 37 /* Note MS GPRS Present Response */ +/* 38-47 For future use. */ +#define GTP_IDEN_REQ 48 /* Identification Request */ +#define GTP_IDEN_RSP 49 /* Identification Response */ +#define GTP_SGSN_CONTEXT_REQ 50 /* SGSN Context Request */ +#define GTP_SGSN_CONTEXT_RSP 51 /* SGSN Context Response */ +#define GTP_SGSN_CONTEXT_ACK 52 /* SGSN Context Acknowledge */ +#define GTP_FWD_RELOC_REQ 53 /* Forward Relocation Request */ +#define GTP_FWD_RELOC_RSP 54 /* Forward Relocation Response */ +#define GTP_FWD_RELOC_COMPL 55 /* Forward Relocation Complete */ +#define GTP_RELOC_CANCEL_REQ 56 /* Relocation Cancel Request */ +#define GTP_RELOC_CANCEL_RSP 57 /* Relocation Cancel Response */ +#define GTP_FWD_SRNS 58 /* Forward SRNS Context */ +#define GTP_FWD_RELOC_ACK 59 /* Forward Relocation Complete Acknowledge */ +#define GTP_FWD_SRNS_ACK 60 /* Forward SRNS Context Acknowledge */ +#define GTP_RAN_INFO_RELAY 70 /* RAN Information Relay */ +/* 61-239 For future use. */ +#define GTP_DATA_TRAN_REQ 240 /* Data Record Transfer Request */ +#define GTP_DATA_TRAN_RSP 241 /* Data Record Transfer Response */ +/* 242-254 For future use. */ +#define GTP_GPDU 255 /* G-PDU */ + +extern const struct value_string gtp_type_names; +static inline const char *gtp_type_name(uint8_t val) +{ return get_value_string(gtp_type_names, val); } + +/* GTP information element cause codes from 29.060 v3.9.0 7.7 */ +/* */ +#define GTPCAUSE_REQ_IMSI 0 /* Request IMSI */ +#define GTPCAUSE_REQ_IMEI 1 /* Request IMEI */ +#define GTPCAUSE_REQ_IMSI_IMEI 2 /* Request IMSI and IMEI */ +#define GTPCAUSE_NO_ID_NEEDED 3 /* No identity needed */ +#define GTPCAUSE_MS_REFUSES_X 4 /* MS refuses */ +#define GTPCAUSE_MS_NOT_RESP_X 5 /* MS is not GPRS responding */ +/* 6-48 For future use */ +/* 49-63 Cause values reserved for GPRS charging protocol use (See GTP' in GSM 12.15) */ +/* 64-127 For future use */ +#define GTPCAUSE_ACC_REQ 128 /* Request accepted */ +#define GTPCAUSE_NEW_PDP_NET_PREF 129 /* New PDP type due to network preference */ +#define GTPCAUSE_NEW_PDP_ADDR_BEAR 130 /* New PDP type due to single address bearer only */ +/* 131-176 For future use */ +/* 177-191 Cause values reserved for GPRS charging protocol use (See GTP' In GSM 12.15) */ +#define GTPCAUSE_NON_EXIST 192 /* Non-existent */ +#define GTPCAUSE_INVALID_MESSAGE 193 /* Invalid message format */ +#define GTPCAUSE_IMSI_NOT_KNOWN 194 /* IMSI not known */ +#define GTPCAUSE_MS_DETACHED 195 /* MS is GPRS detached */ +#define GTPCAUSE_MS_NOT_RESP 196 /* MS is not GPRS responding */ +#define GTPCAUSE_MS_REFUSES 197 /* MS refuses */ +/* 198 For future use */ +#define GTPCAUSE_NO_RESOURCES 199 /* No resources available */ +#define GTPCAUSE_NOT_SUPPORTED 200 /* Service not supported */ +#define GTPCAUSE_MAN_IE_INCORRECT 201 /* Mandatory IE incorrect */ +#define GTPCAUSE_MAN_IE_MISSING 202 /* Mandatory IE missing */ +#define GTPCAUSE_OPT_IE_INCORRECT 203 /* Optional IE incorrect */ +#define GTPCAUSE_SYS_FAIL 204 /* System failure */ +#define GTPCAUSE_ROAMING_REST 205 /* Roaming Restriction */ +#define GTPCAUSE_PTIMSI_MISMATCH 206 /* P-TMSI signature mismatch */ +#define GTPCAUSE_CONN_SUSP 207 /* GPRS connection suspended */ +#define GTPCAUSE_AUTH_FAIL 208 /* Authentication failure */ +#define GTPCAUSE_USER_AUTH_FAIL 209 /* User authentication failed */ +#define GTPCAUSE_CONTEXT_NOT_FOUND 210 /* Context not found */ +#define GTPCAUSE_ADDR_OCCUPIED 211 /* All dynamic PDP addresses are occupied */ +#define GTPCAUSE_NO_MEMORY 212 /* No memory is available */ +#define GTPCAUSE_RELOC_FAIL 213 /* Relocation failure */ +#define GTPCAUSE_UNKNOWN_MAN_EXTHEADER 214 /* Unknown mandatory extension header */ +#define GTPCAUSE_SEM_ERR_TFT 215 /* Semantic error in the TFT operation */ +#define GTPCAUSE_SYN_ERR_TFT 216 /* Syntactic error in the TFT operation */ +#define GTPCAUSE_SEM_ERR_FILTER 217 /* Semantic errors in packet filter(s) */ +#define GTPCAUSE_SYN_ERR_FILTER 218 /* Syntactic errors in packet filter(s) */ +#define GTPCAUSE_MISSING_APN 219 /* Missing or unknown APN */ +#define GTPCAUSE_UNKNOWN_PDP 220 /* Unknown PDP address or PDP type */ +/* 221-240 For future use */ +/* 241-255 Cause Values Reserved For Gprs Charging Protocol Use (See Gtp' In Gsm 12.15) */ + +static inline bool gtp_cause_successful(uint8_t cause) +{ + return cause == GTPCAUSE_ACC_REQ || + cause == GTPCAUSE_NEW_PDP_NET_PREF || + cause == GTPCAUSE_NEW_PDP_ADDR_BEAR; +} + +struct ul66_t; +struct ul16_t; +struct pdp_t; + +/* GTP 0 header. + * Explanation to some of the fields: + * SNDCP NPDU Number flag = 0 except for inter SGSN handover situations + * SNDCP N-PDU LCC Number 0 = 0xff except for inter SGSN handover situations + * Sequence number. Used for reliable delivery of signalling messages, and + * to discard "illegal" data messages. + * Flow label. Is used to point a particular PDP context. Is used in data + * messages as well as signalling messages related to a particular context. + * Tunnel ID is IMSI+NSAPI. Unique identifier of PDP context. Is somewhat + * redundant because the header also includes flow. */ + +struct gtp0_header { /* Descriptions from 3GPP 09.60 */ + uint8_t flags; /* 01 bitfield, with typical values */ + /* 000..... Version: 1 (0) */ + /* ...1111. Spare (7) */ + /* .......0 SNDCP N-PDU Number flag (0) */ + uint8_t type; /* 02 Message type. T-PDU = 0xff */ + uint16_t length; /* 03 Length (of G-PDU excluding header) */ + uint16_t seq; /* 05 Sequence Number */ + uint16_t flow; /* 07 Flow Label ( = 0 for signalling) */ + uint8_t number; /* 09 SNDCP N-PDU LCC Number ( 0 = 0xff) */ + uint8_t spare1; /* 10 Spare */ + uint8_t spare2; /* 11 Spare */ + uint8_t spare3; /* 12 Spare */ + uint64_t tid; /* 13 Tunnel ID */ +} __attribute__((packed)); /* 20 */ + +#define GTP1HDR_F_NPDU 0x01 +#define GTP1HDR_F_SEQ 0x02 +#define GTP1HDR_F_EXT 0x04 +#define GTP1HDR_F_GTP1 0x10 +#define GTPHDR_F_VER(n) ((n) << 5) +#define GTPHDR_F_GET_VER(flags) ((flags)>>5) + +struct gtp1_header_short { /* Descriptions from 3GPP 29060 */ + uint8_t flags; /* 01 bitfield, with typical values */ + /* 001..... Version: 1 */ + /* ...1.... Protocol Type: GTP=1, GTP'=0 */ + /* ....0... Spare = 0 */ + /* .....0.. Extension header flag: 0 */ + /* ......0. Sequence number flag: 0 */ + /* .......0 PN: N-PDU Number flag */ + uint8_t type; /* 02 Message type. T-PDU = 0xff */ + uint16_t length; /* 03 Length (of IP packet or signalling) */ + uint32_t tei; /* 05 - 08 Tunnel Endpoint ID */ +} __attribute__((packed)); +
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp/gtpie.h
Changed
(renamed from gtp/gtpie.h)
View file
osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/include/osmocom/gtp/pdp.h
Changed
(renamed from gtp/pdp.h)
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/Makefile.am -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/Makefile.am
Changed
@@ -19,6 +19,7 @@ -fno-builtin \ -Wall \ -DSBINDIR='"$(sbindir)"' \ + -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ $(NULL)
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/gtp-kernel.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/gtp-kernel.c
Changed
@@ -23,12 +23,13 @@ #include <time.h> +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> + #include "../lib/tun.h" #include "../lib/syserr.h" #include "../lib/util.h" #include "../lib/ippool.h" -#include "../gtp/pdp.h" -#include "../gtp/gtp.h" #include "gtp-kernel.h"
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/icmpv6.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/icmpv6.c
Changed
@@ -21,10 +21,11 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> -#include "checksum.h" -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include <osmocom/gtp/gtp.h> +#include <osmocom/gtp/pdp.h> + +#include "checksum.h" #include "ippool.h" #include "syserr.h" #include "icmpv6.h"
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/icmpv6.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/icmpv6.h
Changed
@@ -5,8 +5,8 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/endian.h> -#include "../gtp/gtp.h" -#include "../gtp/pdp.h" +#include <osmocom/gtp/gtp.h> +#include <osmocom/gtp/pdp.h> #define ICMPv6_OPT_TYPE_PREFIX_INFO 0x03
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/in46_addr.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/in46_addr.c
Changed
@@ -10,7 +10,7 @@ */ #include "../lib/in46_addr.h" -#include "../gtp/pdp.h" +#include <osmocom/gtp/pdp.h> #include <osmocom/core/utils.h>
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/in46_addr.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/in46_addr.h
Changed
@@ -2,7 +2,7 @@ #include <stdint.h> #include <netinet/in.h> -#include "../gtp/pdp.h" +#include <osmocom/gtp/pdp.h> /* a simple wrapper around an in6_addr to also contain the length of the address, * thereby implicitly indicating the address family of the address */
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/ippool.h -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/ippool.h
Changed
@@ -13,7 +13,7 @@ #define _IPPOOL_H #include "../lib/in46_addr.h" -#include "../gtp/gtp.h" +#include <osmocom/gtp/gtp.h> /* Assuming that the address space is fragmented we need a hash table in order to return the addresses.
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/lib/util.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/lib/util.c
Changed
@@ -9,7 +9,7 @@ * */ -#include "../gtp/pdp.h" +#include <osmocom/gtp/pdp.h> #include "ippool.h" #include "in46_addr.h"
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/libgtp.pc.in -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/libgtp.pc.in
Changed
@@ -7,5 +7,8 @@ Description: C Utility Library Version: @VERSION@ Libs: -L${libdir} -lgtp -Cflags: -I${includedir}/ +# Add two include paths to support: +# * #include <osmocom/gtp/gtp.h> (like other Osmocom headers) +# * #include <gtp.h> (legacy compat) +Cflags: -I${includedir}/osmocom/gtp/ -I${includedir}/
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/sgsnemu/Makefile.am -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/sgsnemu/Makefile.am
Changed
@@ -7,6 +7,7 @@ -fno-builtin \ -Wall \ -DSBINDIR='"$(sbindir)"' \ + -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ $(NULL)
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/sgsnemu/sgsnemu.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/sgsnemu/sgsnemu.c
Changed
@@ -54,13 +54,15 @@ #endif // HAVE_IN6_ADDR_GEN_MODE_NONE #endif +#include <osmocom/gtp/pdp.h> +#include <osmocom/gtp/gtp.h> + #include "../lib/tun.h" #include "../lib/ippool.h" #include "../lib/syserr.h" #include "../lib/netns.h" #include "../lib/icmpv6.h" -#include "../gtp/pdp.h" -#include "../gtp/gtp.h" +#include "../gtp/gtp_internal.h" #include "cmdline.h" #define IPADDRLEN 256 /* Character length of addresses */
View file
osmo-ggsn_1.11.0.19.3372.202405152026.tar.xz/tests/gtp/gtpie_test.c -> osmo-ggsn_1.11.0.30.5758.202405162026.tar.xz/tests/gtp/gtpie_test.c
Changed
@@ -10,8 +10,9 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/bits.h> +#include <osmocom/gtp/gtpie.h> + #include "../../lib/syserr.h" -#include "../../gtp/gtpie.h" static const uint8_t in = { 1,2,3,4,5,6 }; static uint8_t buf256;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.