Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 1 | /* NS-over-IP proxy */ |
| 2 | |
| 3 | /* (C) 2010 by Harald Welte <laforge@gnumonks.org> |
| 4 | * (C) 2010 by On Waves |
| 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include <unistd.h> |
| 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> |
| 26 | #include <string.h> |
| 27 | #include <getopt.h> |
| 28 | #include <errno.h> |
| 29 | #include <sys/fcntl.h> |
| 30 | #include <sys/stat.h> |
| 31 | #include <sys/types.h> |
Harald Welte | 7fc9822 | 2010-05-11 10:15:42 +0200 | [diff] [blame] | 32 | #include <arpa/inet.h> |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 33 | |
| 34 | #include <osmocore/talloc.h> |
| 35 | #include <osmocore/select.h> |
| 36 | |
| 37 | #include <openbsc/signal.h> |
| 38 | #include <openbsc/debug.h> |
| 39 | #include <openbsc/gprs_ns.h> |
| 40 | #include <openbsc/gprs_bssgp.h> |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 41 | #include <openbsc/gb_proxy.h> |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 42 | |
| 43 | struct gbprox_peer { |
| 44 | struct llist_head list; |
| 45 | |
| 46 | /* NS-VC over which we send/receive data to this BVC */ |
| 47 | struct gprs_nsvc *nsvc; |
| 48 | |
| 49 | /* BVCI used for Point-to-Point to this peer */ |
| 50 | uint16_t bvci; |
| 51 | |
| 52 | /* Routeing Area that this peer is part of (raw 04.08 encoding) */ |
| 53 | uint8_t ra[6]; |
| 54 | }; |
| 55 | |
| 56 | /* Linked list of all Gb peers (except SGSN) */ |
| 57 | static LLIST_HEAD(gbprox_bts_peers); |
| 58 | |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 59 | /* Find the gbprox_peer by its BVCI */ |
| 60 | static struct gbprox_peer *peer_by_bvci(uint16_t bvci) |
| 61 | { |
| 62 | struct gbprox_peer *peer; |
| 63 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
| 64 | if (peer->bvci == bvci) |
| 65 | return peer; |
| 66 | } |
| 67 | return NULL; |
| 68 | } |
| 69 | |
| 70 | static struct gbprox_peer *peer_by_nsvc(struct gprs_nsvc *nsvc) |
| 71 | { |
| 72 | struct gbprox_peer *peer; |
| 73 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
| 74 | if (peer->nsvc == nsvc) |
| 75 | return peer; |
| 76 | } |
| 77 | return NULL; |
| 78 | } |
| 79 | |
| 80 | /* look-up a peer by its Routeing Area Code (RAC) */ |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 81 | static struct gbprox_peer *peer_by_rac(const uint8_t *ra) |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 82 | { |
| 83 | struct gbprox_peer *peer; |
| 84 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 85 | if (!memcmp(peer->ra, ra, 6)) |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 86 | return peer; |
| 87 | } |
| 88 | return NULL; |
| 89 | } |
| 90 | |
| 91 | /* look-up a peer by its Location Area Code (LAC) */ |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 92 | static struct gbprox_peer *peer_by_lac(const uint8_t *la) |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 93 | { |
| 94 | struct gbprox_peer *peer; |
| 95 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 96 | if (!memcmp(peer->ra, la, 5)) |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 97 | return peer; |
| 98 | } |
| 99 | return NULL; |
| 100 | } |
| 101 | |
| 102 | static struct gbprox_peer *peer_alloc(uint16_t bvci) |
| 103 | { |
| 104 | struct gbprox_peer *peer; |
| 105 | |
| 106 | peer = talloc_zero(tall_bsc_ctx, struct gbprox_peer); |
| 107 | if (!peer) |
| 108 | return NULL; |
| 109 | |
| 110 | peer->bvci = bvci; |
| 111 | llist_add(&peer->list, &gbprox_bts_peers); |
| 112 | |
| 113 | return peer; |
| 114 | } |
| 115 | |
| 116 | static void peer_free(struct gbprox_peer *peer) |
| 117 | { |
| 118 | llist_del(&peer->list); |
| 119 | talloc_free(peer); |
| 120 | } |
| 121 | |
Harald Welte | 39d0bb5 | 2010-05-12 18:10:25 +0000 | [diff] [blame] | 122 | /* FIXME: this needs to go to libosmocore/msgb.c */ |
| 123 | static struct msgb *msgb_copy(const struct msgb *msg, const char *name) |
| 124 | { |
| 125 | struct msgb *new_msg; |
| 126 | |
| 127 | new_msg = msgb_alloc(msg->data_len, name); |
| 128 | if (!new_msg) |
| 129 | return NULL; |
| 130 | |
| 131 | /* copy header */ |
| 132 | memcpy(new_msg, msg, sizeof(*new_msg)); |
| 133 | /* copy data */ |
| 134 | memcpy(new_msg->data, msg->data, new_msg->data_len); |
| 135 | |
| 136 | return new_msg; |
| 137 | } |
| 138 | |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 139 | /* strip off the NS header */ |
| 140 | static void strip_ns_hdr(struct msgb *msg) |
| 141 | { |
| 142 | int strip_len = msgb_bssgph(msg) - msg->data; |
| 143 | msgb_pull(msg, strip_len); |
| 144 | } |
| 145 | |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 146 | /* feed a message down the NS-VC associated with the specified peer */ |
Harald Welte | 39d0bb5 | 2010-05-12 18:10:25 +0000 | [diff] [blame] | 147 | static int gbprox_relay2sgsn(struct msgb *old_msg, uint16_t ns_bvci) |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 148 | { |
Harald Welte | 39d0bb5 | 2010-05-12 18:10:25 +0000 | [diff] [blame] | 149 | /* create a copy of the message so the old one can |
| 150 | * be free()d safely when we return from gbprox_rcvmsg() */ |
| 151 | struct msgb *msg = msgb_copy(old_msg, "msgb_relay2sgsn"); |
| 152 | |
Harald Welte | e9ea269 | 2010-05-11 20:20:13 +0200 | [diff] [blame] | 153 | DEBUGP(DGPRS, "NSEI=%u proxying BTS->SGSN (NS_BVCI=%u, NSEI=%u)\n", |
Harald Welte | 96f71f2 | 2010-05-03 19:28:05 +0200 | [diff] [blame] | 154 | msgb_nsei(msg), ns_bvci, gbcfg.nsip_sgsn_nsei); |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 155 | |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 156 | msgb_bvci(msg) = ns_bvci; |
| 157 | msgb_nsei(msg) = gbcfg.nsip_sgsn_nsei; |
| 158 | |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 159 | strip_ns_hdr(msg); |
| 160 | |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 161 | return gprs_ns_sendmsg(bssgp_nsi, msg); |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 162 | } |
| 163 | |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 164 | /* feed a message down the NS-VC associated with the specified peer */ |
Harald Welte | 39d0bb5 | 2010-05-12 18:10:25 +0000 | [diff] [blame] | 165 | static int gbprox_relay2peer(struct msgb *old_msg, struct gbprox_peer *peer, |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 166 | uint16_t ns_bvci) |
| 167 | { |
Harald Welte | 39d0bb5 | 2010-05-12 18:10:25 +0000 | [diff] [blame] | 168 | /* create a copy of the message so the old one can |
| 169 | * be free()d safely when we return from gbprox_rcvmsg() */ |
| 170 | struct msgb *msg = msgb_copy(old_msg, "msgb_relay2peer"); |
| 171 | |
Harald Welte | 0ab535b | 2010-05-13 10:34:56 +0200 | [diff] [blame] | 172 | DEBUGP(DGPRS, "NSEI=%u proxying SGSN->BSS (NS_BVCI=%u, NSEI=%u)\n", |
Harald Welte | 96f71f2 | 2010-05-03 19:28:05 +0200 | [diff] [blame] | 173 | msgb_nsei(msg), ns_bvci, peer->nsvc->nsei); |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 174 | |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 175 | msgb_bvci(msg) = ns_bvci; |
| 176 | msgb_nsei(msg) = peer->nsvc->nsei; |
| 177 | |
Harald Welte | 0ab535b | 2010-05-13 10:34:56 +0200 | [diff] [blame] | 178 | /* Strip the old NS header, it will be replaced with a new one */ |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 179 | strip_ns_hdr(msg); |
| 180 | |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 181 | return gprs_ns_sendmsg(bssgp_nsi, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | /* Send a message to a peer identified by ptp_bvci but using ns_bvci |
| 185 | * in the NS hdr */ |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 186 | static int gbprox_relay2bvci(struct msgb *msg, uint16_t ptp_bvci, |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 187 | uint16_t ns_bvci) |
| 188 | { |
| 189 | struct gbprox_peer *peer; |
| 190 | |
| 191 | peer = peer_by_bvci(ptp_bvci); |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 192 | if (!peer) { |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 193 | LOGP(DGPRS, LOGL_ERROR, "BVCI=%u: Cannot find BSS\n", |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 194 | ptp_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 195 | return -ENOENT; |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 196 | } |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 197 | |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 198 | return gbprox_relay2peer(msg, peer, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | /* Receive an incoming signalling message from a BSS-side NS-VC */ |
| 202 | static int gbprox_rx_sig_from_bss(struct msgb *msg, struct gprs_nsvc *nsvc, |
| 203 | uint16_t ns_bvci) |
| 204 | { |
Harald Welte | ca3620a | 2010-05-03 16:30:59 +0200 | [diff] [blame] | 205 | struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 206 | struct tlv_parsed tp; |
| 207 | uint8_t pdu_type = bgph->pdu_type; |
Harald Welte | ca3620a | 2010-05-03 16:30:59 +0200 | [diff] [blame] | 208 | int data_len = msgb_bssgp_len(msg) - sizeof(*bgph); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 209 | struct gbprox_peer *from_peer; |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 210 | struct gprs_ra_id raid; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 211 | |
| 212 | if (ns_bvci != 0) { |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 213 | LOGP(DGPRS, LOGL_NOTICE, "NSEI=%u BVCI=%u is not signalling\n", |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 214 | nsvc->nsei, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 215 | return -EINVAL; |
| 216 | } |
| 217 | |
| 218 | /* we actually should never see those two for BVCI == 0, but double-check |
| 219 | * just to make sure */ |
| 220 | if (pdu_type == BSSGP_PDUT_UL_UNITDATA || |
| 221 | pdu_type == BSSGP_PDUT_DL_UNITDATA) { |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 222 | LOGP(DGPRS, LOGL_NOTICE, "NSEI=%u UNITDATA not allowed in " |
| 223 | "signalling\n", nsvc->nsei); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 224 | return -EINVAL; |
| 225 | } |
| 226 | |
| 227 | bssgp_tlv_parse(&tp, bgph->data, data_len); |
| 228 | |
| 229 | switch (pdu_type) { |
| 230 | case BSSGP_PDUT_SUSPEND: |
| 231 | case BSSGP_PDUT_RESUME: |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 232 | /* We implement RAC snooping during SUSPEND/RESUME, since |
| 233 | * it establishes a relationsip between BVCI/peer and the |
| 234 | * routeing area code. The snooped information is then |
| 235 | * used for routing the {SUSPEND,RESUME}_[N]ACK back to |
| 236 | * the correct BSSGP */ |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 237 | if (!TLVP_PRESENT(&tp, BSSGP_IE_ROUTEING_AREA)) |
| 238 | goto err_mand_ie; |
| 239 | from_peer = peer_by_nsvc(nsvc); |
| 240 | if (!from_peer) |
| 241 | goto err_no_peer; |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 242 | memcpy(from_peer->ra, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA), |
| 243 | sizeof(from_peer->ra)); |
Harald Welte | 7fc9822 | 2010-05-11 10:15:42 +0200 | [diff] [blame] | 244 | gsm48_parse_ra(&raid, from_peer->ra); |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 245 | LOGP(DGPRS, LOGL_INFO, "NSEI=%u BSSGP SUSPEND/RESUME " |
| 246 | "RAC snooping: RAC %u-%u-%u-%u behind BVCI=%u, " |
| 247 | "NSVCI=%u\n",nsvc->nsei, raid.mcc, raid.mnc, raid.lac, |
| 248 | raid.rac , from_peer->bvci, nsvc->nsvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 249 | /* FIXME: This only supports one BSS per RA */ |
| 250 | break; |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 251 | case BSSGP_PDUT_BVC_RESET: |
| 252 | /* If we receive a BVC reset on the signalling endpoint, we |
| 253 | * don't want the SGSN to reset, as the signalling endpoint |
| 254 | * is common for all point-to-point BVCs (and thus all BTS) */ |
| 255 | if (TLVP_PRESENT(&tp, BSSGP_IE_BVCI)) { |
| 256 | uint16_t bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI)); |
Harald Welte | 72953b8 | 2010-05-12 00:20:41 +0200 | [diff] [blame] | 257 | LOGP(DGPRS, LOGL_INFO, "NSEI=%u Rx BVC RESET (BVCI=%u)\n", |
Harald Welte | e9ea269 | 2010-05-11 20:20:13 +0200 | [diff] [blame] | 258 | nsvc->nsei, bvci); |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 259 | if (bvci == 0) { |
| 260 | /* FIXME: only do this if SGSN is alive! */ |
Harald Welte | e9ea269 | 2010-05-11 20:20:13 +0200 | [diff] [blame] | 261 | LOGP(DGPRS, LOGL_INFO, "NSEI=%u Tx fake " |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 262 | "BVC RESET ACK of BVCI=0\n", nsvc->nsei); |
| 263 | return bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, |
| 264 | nsvc->nsei, 0, ns_bvci); |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 265 | } |
| 266 | from_peer = peer_by_bvci(bvci); |
| 267 | if (!from_peer) { |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 268 | /* if a PTP-BVC is reset, and we don't know that |
| 269 | * PTP-BVCI yet, we should allocate a new peer */ |
| 270 | LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for " |
| 271 | "BVCI=%u via NSVCI=%u/NSEI=%u\n", bvci, |
| 272 | nsvc->nsvci, nsvc->nsei); |
| 273 | from_peer = peer_alloc(bvci); |
| 274 | from_peer->nsvc = nsvc; |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 275 | } |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 276 | if (TLVP_PRESENT(&tp, BSSGP_IE_CELL_ID)) { |
| 277 | struct gprs_ra_id raid; |
| 278 | /* We have a Cell Identifier present in this |
| 279 | * PDU, this means we can extend our local |
| 280 | * state information about this particular cell |
| 281 | * */ |
| 282 | memcpy(from_peer->ra, |
| 283 | TLVP_VAL(&tp, BSSGP_IE_CELL_ID), |
| 284 | sizeof(from_peer->ra)); |
| 285 | gsm48_parse_ra(&raid, from_peer->ra); |
| 286 | LOGP(DGPRS, LOGL_INFO, "NSEI=%u/BVCI=%u " |
Harald Welte | 72953b8 | 2010-05-12 00:20:41 +0200 | [diff] [blame] | 287 | "Cell ID %u-%u-%u-%u\n", nsvc->nsei, |
Harald Welte | 1174c08 | 2010-05-12 00:07:29 +0200 | [diff] [blame] | 288 | bvci, raid.mcc, raid.mnc, raid.lac, |
| 289 | raid.rac); |
| 290 | } |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 291 | } |
| 292 | break; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 293 | } |
| 294 | |
Harald Welte | e9ea269 | 2010-05-11 20:20:13 +0200 | [diff] [blame] | 295 | /* Normally, we can simply pass on all signalling messages from BSS to |
| 296 | * SGSN */ |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 297 | return gbprox_relay2sgsn(msg, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 298 | err_no_peer: |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 299 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(BSS) cannot find peer based on RAC\n", |
| 300 | nsvc->nsei); |
| 301 | return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 302 | err_mand_ie: |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 303 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(BSS) missing mandatory RA IE\n", |
| 304 | nsvc->nsei); |
| 305 | return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | /* Receive paging request from SGSN, we need to relay to proper BSS */ |
| 309 | static int gbprox_rx_paging(struct msgb *msg, struct tlv_parsed *tp, |
| 310 | struct gprs_nsvc *nsvc, uint16_t ns_bvci) |
| 311 | { |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 312 | struct gbprox_peer *peer = NULL; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 313 | |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 314 | LOGP(DGPRS, LOGL_INFO, "NSEI=%u(SGSN) BSSGP PAGING ", |
| 315 | nsvc->nsei); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 316 | if (TLVP_PRESENT(tp, BSSGP_IE_BVCI)) { |
| 317 | uint16_t bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI)); |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 318 | LOGPC(DGPRS, LOGL_INFO, "routing by BVCI to peer BVCI=%u\n", |
| 319 | bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 320 | } else if (TLVP_PRESENT(tp, BSSGP_IE_ROUTEING_AREA)) { |
| 321 | peer = peer_by_rac(TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA)); |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 322 | LOGPC(DGPRS, LOGL_INFO, "routing by RAC to peer BVCI=%u\n", |
| 323 | peer->bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 324 | } else if (TLVP_PRESENT(tp, BSSGP_IE_LOCATION_AREA)) { |
| 325 | peer = peer_by_lac(TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA)); |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 326 | LOGPC(DGPRS, LOGL_INFO, "routing by LAC to peer BVCI=%u\n", |
| 327 | peer->bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 328 | } else |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 329 | LOGPC(DGPRS, LOGL_INFO, "\n"); |
| 330 | |
| 331 | if (!peer) { |
| 332 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(SGSN) BSSGP PAGING: " |
| 333 | "unable to route, missing IE\n", nsvc->nsei); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 334 | return -EINVAL; |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 335 | } |
| 336 | return gbprox_relay2peer(msg, peer, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 337 | } |
| 338 | |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 339 | /* Receive an incoming BVC-RESET message from the SGSN */ |
| 340 | static int rx_reset_from_sgsn(struct msgb *msg, struct tlv_parsed *tp, |
| 341 | struct gprs_nsvc *nsvc, uint16_t ns_bvci) |
| 342 | { |
| 343 | struct gbprox_peer *peer; |
| 344 | uint16_t ptp_bvci; |
| 345 | |
| 346 | if (!TLVP_PRESENT(tp, BSSGP_IE_BVCI)) { |
| 347 | return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, |
| 348 | NULL, msg); |
| 349 | } |
| 350 | ptp_bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI)); |
| 351 | |
| 352 | if (ptp_bvci >= 2) { |
| 353 | /* A reset for a PTP BVC was received, forward it to its |
| 354 | * respective peer */ |
| 355 | peer = peer_by_bvci(ptp_bvci); |
| 356 | if (!peer) { |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 357 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u BVCI=%u: Cannot find BSS\n", |
| 358 | nsvc->nsei, ptp_bvci); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 359 | return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, |
| 360 | NULL, msg); |
| 361 | } |
| 362 | return gbprox_relay2peer(msg, peer, ns_bvci); |
| 363 | } |
| 364 | |
| 365 | /* A reset for the Signalling entity has been received |
| 366 | * from the SGSN. As the signalling BVCI is shared |
| 367 | * among all the BSS's that we multiplex, it needs to |
| 368 | * be relayed */ |
| 369 | llist_for_each_entry(peer, &gbprox_bts_peers, list) |
| 370 | gbprox_relay2peer(msg, peer, ns_bvci); |
| 371 | |
| 372 | return 0; |
| 373 | } |
| 374 | |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 375 | /* Receive an incoming signalling message from the SGSN-side NS-VC */ |
| 376 | static int gbprox_rx_sig_from_sgsn(struct msgb *msg, struct gprs_nsvc *nsvc, |
| 377 | uint16_t ns_bvci) |
| 378 | { |
Harald Welte | ca3620a | 2010-05-03 16:30:59 +0200 | [diff] [blame] | 379 | struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 380 | struct tlv_parsed tp; |
| 381 | uint8_t pdu_type = bgph->pdu_type; |
Harald Welte | ca3620a | 2010-05-03 16:30:59 +0200 | [diff] [blame] | 382 | int data_len = msgb_bssgp_len(msg) - sizeof(*bgph); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 383 | struct gbprox_peer *peer; |
| 384 | uint16_t bvci; |
| 385 | int rc = 0; |
| 386 | |
| 387 | if (ns_bvci != 0) { |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 388 | LOGP(DGPRS, LOGL_NOTICE, "NSEI=%u(SGSN) BVCI=%u is not " |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 389 | "signalling\n", nsvc->nsei, ns_bvci); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 390 | /* FIXME: Send proper error message */ |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 391 | return -EINVAL; |
| 392 | } |
| 393 | |
| 394 | /* we actually should never see those two for BVCI == 0, but double-check |
| 395 | * just to make sure */ |
| 396 | if (pdu_type == BSSGP_PDUT_UL_UNITDATA || |
| 397 | pdu_type == BSSGP_PDUT_DL_UNITDATA) { |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 398 | LOGP(DGPRS, LOGL_NOTICE, "NSEI=%u(SGSN) UNITDATA not allowed in " |
| 399 | "signalling\n", nsvc->nsei); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 400 | return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | rc = bssgp_tlv_parse(&tp, bgph->data, data_len); |
| 404 | |
| 405 | switch (pdu_type) { |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 406 | case BSSGP_PDUT_BVC_RESET: |
| 407 | rc = rx_reset_from_sgsn(msg, &tp, nsvc, ns_bvci); |
| 408 | break; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 409 | case BSSGP_PDUT_FLUSH_LL: |
| 410 | case BSSGP_PDUT_BVC_BLOCK_ACK: |
| 411 | case BSSGP_PDUT_BVC_UNBLOCK_ACK: |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 412 | case BSSGP_PDUT_BVC_RESET_ACK: |
| 413 | /* simple case: BVCI IE is mandatory */ |
| 414 | if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI)) |
| 415 | goto err_mand_ie; |
| 416 | bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI)); |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 417 | rc = gbprox_relay2bvci(msg, bvci, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 418 | break; |
| 419 | case BSSGP_PDUT_PAGING_PS: |
| 420 | case BSSGP_PDUT_PAGING_CS: |
| 421 | /* process the paging request (LAC/RAC lookup) */ |
| 422 | rc = gbprox_rx_paging(msg, &tp, nsvc, ns_bvci); |
| 423 | break; |
| 424 | case BSSGP_PDUT_STATUS: |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 425 | /* Some exception has occurred */ |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 426 | LOGP(DGPRS, LOGL_NOTICE, |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 427 | "NSEI=%u(SGSN) BSSGP STATUS ", nsvc->nsei); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 428 | if (!TLVP_PRESENT(&tp, BSSGP_IE_CAUSE)) { |
| 429 | LOGPC(DGPRS, LOGL_NOTICE, "\n"); |
| 430 | goto err_mand_ie; |
| 431 | } |
| 432 | LOGPC(DGPRS, LOGL_NOTICE, |
| 433 | "cause=0x%02x(%s) ", *TLVP_VAL(&tp, BSSGP_IE_CAUSE), |
| 434 | bssgp_cause_str(*TLVP_VAL(&tp, BSSGP_IE_CAUSE))); |
| 435 | if (TLVP_PRESENT(&tp, BSSGP_IE_BVCI)) { |
Harald Welte | 7fc9822 | 2010-05-11 10:15:42 +0200 | [diff] [blame] | 436 | uint16_t *bvci = (uint16_t *) |
| 437 | TLVP_VAL(&tp, BSSGP_IE_BVCI); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 438 | LOGPC(DGPRS, LOGL_NOTICE, |
| 439 | "BVCI=%u\n", ntohs(*bvci)); |
| 440 | } else |
| 441 | LOGPC(DGPRS, LOGL_NOTICE, "\n"); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 442 | break; |
| 443 | /* those only exist in the SGSN -> BSS direction */ |
| 444 | case BSSGP_PDUT_SUSPEND_ACK: |
| 445 | case BSSGP_PDUT_SUSPEND_NACK: |
| 446 | case BSSGP_PDUT_RESUME_ACK: |
| 447 | case BSSGP_PDUT_RESUME_NACK: |
| 448 | /* RAC IE is mandatory */ |
| 449 | if (!TLVP_PRESENT(&tp, BSSGP_IE_ROUTEING_AREA)) |
| 450 | goto err_mand_ie; |
| 451 | peer = peer_by_rac(TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA)); |
| 452 | if (!peer) |
| 453 | goto err_no_peer; |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 454 | rc = gbprox_relay2peer(msg, peer, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 455 | break; |
| 456 | case BSSGP_PDUT_SGSN_INVOKE_TRACE: |
Harald Welte | 44c4830 | 2010-05-03 19:22:32 +0200 | [diff] [blame] | 457 | LOGP(DGPRS, LOGL_ERROR, |
Harald Welte | 4cf12e9 | 2010-05-13 14:14:56 +0200 | [diff] [blame] | 458 | "NSEI=%u(SGSN) BSSGP INVOKE TRACE not supported\n",nsvc->nsei); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 459 | rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 460 | break; |
| 461 | default: |
Harald Welte | 72953b8 | 2010-05-12 00:20:41 +0200 | [diff] [blame] | 462 | LOGP(DGPRS, LOGL_NOTICE, "BSSGP PDU type 0x%02x unknown\n", |
| 463 | pdu_type); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 464 | rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 465 | break; |
| 466 | } |
| 467 | |
| 468 | return rc; |
| 469 | err_mand_ie: |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 470 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(SGSN) missing mandatory IE\n", |
| 471 | nsvc->nsei); |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 472 | return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 473 | err_no_peer: |
Harald Welte | 0a4050c | 2010-05-11 10:01:17 +0200 | [diff] [blame] | 474 | LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(SGSN) cannot find peer based on RAC\n", |
| 475 | nsvc->nsei); |
| 476 | return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | /* Main input function for Gb proxy */ |
| 480 | int gbprox_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci) |
| 481 | { |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 482 | int rc; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 483 | |
| 484 | /* Only BVCI=0 messages need special treatment */ |
| 485 | if (ns_bvci == 0 || ns_bvci == 1) { |
| 486 | if (nsvc->remote_end_is_sgsn) |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 487 | rc = gbprox_rx_sig_from_sgsn(msg, nsvc, ns_bvci); |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 488 | else |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 489 | rc = gbprox_rx_sig_from_bss(msg, nsvc, ns_bvci); |
| 490 | } else { |
| 491 | /* All other BVCI are PTP and thus can be simply forwarded */ |
Harald Welte | 1c77c6e | 2010-05-03 21:37:11 +0200 | [diff] [blame] | 492 | if (!nsvc->remote_end_is_sgsn) { |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 493 | rc = gbprox_relay2sgsn(msg, ns_bvci); |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 494 | } else { |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 495 | struct gbprox_peer *peer = peer_by_bvci(ns_bvci); |
| 496 | if (!peer) { |
Harald Welte | 72953b8 | 2010-05-12 00:20:41 +0200 | [diff] [blame] | 497 | LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for " |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 498 | "BVCI=%u via NSVC=%u/NSEI=%u\n", ns_bvci, |
| 499 | nsvc->nsvci, nsvc->nsei); |
| 500 | peer = peer_alloc(ns_bvci); |
| 501 | peer->nsvc = nsvc; |
| 502 | } |
Harald Welte | 69619e3 | 2010-05-03 19:05:10 +0200 | [diff] [blame] | 503 | rc = gbprox_relay2peer(msg, peer, ns_bvci); |
Harald Welte | 70f38d2 | 2010-05-01 12:10:57 +0200 | [diff] [blame] | 504 | } |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 505 | } |
| 506 | |
Harald Welte | 672f5c4 | 2010-05-03 18:54:58 +0200 | [diff] [blame] | 507 | return rc; |
Harald Welte | 9f75c35 | 2010-04-30 20:26:32 +0200 | [diff] [blame] | 508 | } |
Harald Welte | 85801d0 | 2010-05-11 05:49:43 +0200 | [diff] [blame] | 509 | |
Harald Welte | 1ccbf44 | 2010-05-14 11:53:08 +0000 | [diff] [blame] | 510 | int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi) |
| 511 | { |
| 512 | struct gprs_nsvc *nsvc; |
| 513 | |
| 514 | llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) { |
| 515 | if (!nsvc->persistent) |
| 516 | continue; |
| 517 | gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); |
| 518 | } |
| 519 | return 0; |
| 520 | } |
| 521 | |
Harald Welte | c1c1dd2 | 2010-05-11 06:34:24 +0200 | [diff] [blame] | 522 | /* Signal handler for signals from NS layer */ |
| 523 | int gbprox_signal(unsigned int subsys, unsigned int signal, |
| 524 | void *handler_data, void *signal_data) |
| 525 | { |
| 526 | struct ns_signal_data *nssd = signal_data; |
| 527 | struct gprs_nsvc *nsvc = nssd->nsvc; |
| 528 | struct gbprox_peer *peer; |
| 529 | |
| 530 | if (subsys != SS_NS) |
| 531 | return 0; |
| 532 | |
Harald Welte | f69c059 | 2010-05-11 18:29:44 +0200 | [diff] [blame] | 533 | if (signal == S_NS_RESET && nsvc->nsei == gbcfg.nsip_sgsn_nsei) { |
| 534 | /* We have received a NS-RESET from the NSEI and NSVC |
| 535 | * of the SGSN. This might happen with SGSN that start |
| 536 | * their own NS-RESET procedure without waiting for our |
| 537 | * NS-RESET */ |
| 538 | nsvc->remote_end_is_sgsn = 1; |
| 539 | } |
| 540 | |
Harald Welte | b778d2c | 2010-05-12 13:28:25 +0000 | [diff] [blame] | 541 | if (signal == S_NS_ALIVE_EXP && nsvc->remote_end_is_sgsn) { |
| 542 | LOGP(DGPRS, LOGL_NOTICE, "Tns alive expired too often, " |
| 543 | "re-starting RESET procedure\n"); |
| 544 | nsip_connect(nsvc->nsi, &nsvc->ip.bts_addr, nsvc->nsei, |
| 545 | nsvc->nsvci); |
| 546 | } |
| 547 | |
Harald Welte | c1c1dd2 | 2010-05-11 06:34:24 +0200 | [diff] [blame] | 548 | /* We currently only care about signals from the SGSN */ |
| 549 | if (!nsvc->remote_end_is_sgsn) |
| 550 | return 0; |
| 551 | |
| 552 | /* iterate over all BTS peers and send the respective PDU */ |
| 553 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
| 554 | switch (signal) { |
| 555 | case S_NS_RESET: |
| 556 | gprs_ns_tx_reset(peer->nsvc, nssd->cause); |
| 557 | break; |
| 558 | case S_NS_BLOCK: |
| 559 | gprs_ns_tx_block(peer->nsvc, nssd->cause); |
| 560 | break; |
| 561 | case S_NS_UNBLOCK: |
| 562 | gprs_ns_tx_unblock(peer->nsvc); |
| 563 | break; |
| 564 | } |
| 565 | } |
| 566 | return 0; |
| 567 | } |
| 568 | |
Harald Welte | 85801d0 | 2010-05-11 05:49:43 +0200 | [diff] [blame] | 569 | |
| 570 | #include <vty/command.h> |
| 571 | |
| 572 | gDEFUN(show_gbproxy, show_gbproxy_cmd, "show gbproxy", |
| 573 | SHOW_STR "Display information about the Gb proxy") |
| 574 | { |
| 575 | struct gbprox_peer *peer; |
| 576 | |
| 577 | llist_for_each_entry(peer, &gbprox_bts_peers, list) { |
| 578 | struct gprs_nsvc *nsvc = peer->nsvc; |
| 579 | struct gprs_ra_id raid; |
Harald Welte | 7fc9822 | 2010-05-11 10:15:42 +0200 | [diff] [blame] | 580 | gsm48_parse_ra(&raid, peer->ra); |
Harald Welte | 85801d0 | 2010-05-11 05:49:43 +0200 | [diff] [blame] | 581 | |
| 582 | vty_out(vty, "NSEI %5u, NS-VC %5u, PTP-BVCI %u, " |
| 583 | "RAC %u-%u-%u-%u%s", |
| 584 | nsvc->nsei, nsvc->nsvci, peer->bvci, |
| 585 | raid.mcc, raid.mnc, raid.lac, raid.rac, VTY_NEWLINE); |
| 586 | if (nsvc->nsi->ll == GPRS_NS_LL_UDP) |
| 587 | vty_out(vty, " remote address %s:%u%s", |
| 588 | inet_ntoa(nsvc->ip.bts_addr.sin_addr), |
| 589 | ntohs(nsvc->ip.bts_addr.sin_port), VTY_NEWLINE); |
| 590 | } |
| 591 | return CMD_SUCCESS; |
| 592 | } |