diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-03-14 23:30:30 +0800 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-03-22 19:02:04 +0800 |
commit | af387633db31059973e0ba59729802203b229248 (patch) | |
tree | cf2272e4f72a91f73586c4ed4658da6c94c82be3 /openbsc | |
parent | 97a282b037408438a876af81e2e9c5194c2bb69e (diff) |
GPRS: make NSVC parameters VTY-configurable
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/gsm_data.h | 4 | ||||
-rw-r--r-- | openbsc/src/bsc_init.c | 9 | ||||
-rw-r--r-- | openbsc/src/vty_interface.c | 85 |
3 files changed, 88 insertions, 10 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 1c18c55d9..18d557b39 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -375,6 +375,9 @@ struct gsm_bts_gprs_nsvc { struct gsm_bts *bts; int id; u_int16_t nsvci; + u_int16_t local_port; + u_int16_t remote_port; + u_int32_t remote_ip; struct gsm_nm_state nm_state; }; @@ -463,6 +466,7 @@ struct gsm_bts { /* Not entirely sure how ip.access specific this is */ struct { + int enabled; struct { struct gsm_nm_state nm_state; } nse; diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 3fc818447..824820439 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -870,8 +870,13 @@ static void patch_nm_tables(struct gsm_bts *bts) nanobts_attr_nsvc0[3] = bts->gprs.nsvc[0].nsvci >> 8; nanobts_attr_nsvc0[4] = bts->gprs.nsvc[0].nsvci & 0xff; - /* FIXME: patch our own IP address as SGSN IP */ - //nanobts_attr_nsvc0[10] = + /* patch IP address as SGSN IP */ + *(u_int16_t *)(nanobts_attr_nsvc0+8) = + htons(bts->gprs.nsvc[0].remote_port); + *(u_int32_t *)(nanobts_attr_nsvc0+10) = + htonl(bts->gprs.nsvc[0].remote_ip); + *(u_int16_t *)(nanobts_attr_nsvc0+14) = + htons(bts->gprs.nsvc[0].local_port); /* patch BVCI */ nanobts_attr_cell[12] = bts->gprs.cell.bvci >> 8; diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index c789a154e..72a5eae9f 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -1,5 +1,5 @@ /* OpenBSC interface to quagga VTY */ -/* (C) 2009 by Harald Welte <laforge@gnumonks.org> +/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -314,12 +314,28 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) config_write_e1_link(vty, &bts->oml_e1_link, " oml "); vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE); } - vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, VTY_NEWLINE); - vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, - VTY_NEWLINE); - for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) - vty_out(vty, " gprs nsvc %u nsvci %u%s", i, - bts->gprs.cell.bvci, VTY_NEWLINE); + vty_out(vty, " gprs enabled %u%s", bts->gprs.enabled, VTY_NEWLINE); + if (bts->gprs.enabled) { + vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, + VTY_NEWLINE); + vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, + VTY_NEWLINE); + for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { + struct gsm_bts_gprs_nsvc *nsvc = + &bts->gprs.nsvc[i]; + struct in_addr ia; + + ia.s_addr = htonl(nsvc->remote_ip); + vty_out(vty, " gprs nsvc %u nsvci %u%s", i, + nsvc->nsvci, VTY_NEWLINE); + vty_out(vty, " gprs nsvc %u local udp port %u%s", i, + nsvc->local_port, VTY_NEWLINE); + vty_out(vty, " gprs nsvc %u remote udp port %u%s", i, + nsvc->remote_port, VTY_NEWLINE); + vty_out(vty, " gprs nsvc %u remote ip %s%s", i, + inet_ntoa(ia), VTY_NEWLINE); + } + } llist_for_each_entry(trx, &bts->trx_list, list) config_write_trx_single(vty, trx); @@ -1611,7 +1627,7 @@ DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd, return CMD_SUCCESS; } -DEFUN(cfg_bts_gprs_bvci, cfg_bts_gprs_bvci_cmd, +DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, "gprs cell bvci <0-65535>", "GPRS BSSGP VC Identifier") { @@ -1634,6 +1650,44 @@ DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, + "gprs nsvc <0-1> local udp port <0-65535>", + "GPRS NS Local UDP Port") +{ + struct gsm_bts *bts = vty->index; + int idx = atoi(argv[0]); + + bts->gprs.nsvc[idx].local_port = atoi(argv[1]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, + "gprs nsvc <0-1> remote udp port <0-65535>", + "GPRS NS Remote UDP Port") +{ + struct gsm_bts *bts = vty->index; + int idx = atoi(argv[0]); + + bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, + "gprs nsvc <0-1> remote ip A.B.C.D", + "GPRS NS Remote IP Address") +{ + struct gsm_bts *bts = vty->index; + int idx = atoi(argv[0]); + struct in_addr ia; + + inet_aton(argv[1], &ia); + bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr); + + return CMD_SUCCESS; +} + DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, "gprs routing area <0-255>", "GPRS Routing Area Code") @@ -1645,6 +1699,17 @@ DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_gprs_enabled, cfg_bts_gprs_enabled_cmd, + "gprs enabled <0-1>", + "GPRS Enabled on this BTS") +{ + struct gsm_bts *bts = vty->index; + + bts->gprs.enabled = atoi(argv[0]); + + return CMD_SUCCESS; +} + /* per TRX configuration */ DEFUN(cfg_trx, @@ -1906,9 +1971,13 @@ int bsc_vty_init(struct gsm_network *net) install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd); install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); + install_element(BTS_NODE, &cfg_bts_gprs_enabled_cmd); install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); + install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); + install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); + install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd); install_element(BTS_NODE, &cfg_trx_cmd); install_node(&trx_node, dummy_config_write); |