ctrl: drop deprecated neighbor resolution interface

Related: OS#5809
Change-Id: Iff008c77ab49dd8855d54d2d44198475086012e4
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index de6b669..2ad5c71 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -131,8 +131,6 @@
 	pcu->vty.ws_pdch = 0;
 	pcu->vty.llc_codel_interval_msec = LLC_CODEL_USE_DEFAULT;
 	pcu->vty.llc_idle_ack_csec = 10;
-	pcu->vty.neigh_ctrl_addr = NULL; /* don't use CTRL iface for Neigh Addr Resolution */
-	pcu->vty.neigh_ctrl_port = OSMO_CTRL_PORT_BSC_NEIGH;
 
 	pcu->T_defs = T_defs_pcu;
 	osmo_tdefs_reset(pcu->T_defs);
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index 956f0e7..66cfca3 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -112,9 +112,6 @@
 		uint32_t llc_discard_csec;
 		uint32_t llc_idle_ack_csec;
 		uint32_t llc_codel_interval_msec; /* 0=disabled, -1=use default interval */
-		/* Remote BSS resolution sevice (CTRL iface) */
-		char *neigh_ctrl_addr;
-		uint16_t neigh_ctrl_port;
 	} vty;
 
 	struct gsmtap_inst *gsmtap;
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index 0719d2c..c513423 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -358,63 +358,11 @@
 	}
 }
 
-static int send_neigh_addr_req_ctrl_iface(struct nacc_fsm_ctx *ctx)
-{
-	struct gprs_rlcmac_bts *bts = ctx->ms->bts;
-	struct gprs_pcu *pcu = bts->pcu;
-	struct ctrl_cmd *cmd = NULL;
-	int rc;
-
-	/* We may have changed to this state previously (eg: we are handling
-	 * another Pkt cell Change Notify with different target). Avoid
-	 * re-creating the socket in that case. */
-	if (ctx->neigh_ctrl_conn->write_queue.bfd.fd == -1) {
-		rc = osmo_sock_init2_ofd(&ctx->neigh_ctrl_conn->write_queue.bfd,
-					 AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP,
-					 NULL, 0, pcu->vty.neigh_ctrl_addr, pcu->vty.neigh_ctrl_port,
-					 OSMO_SOCK_F_CONNECT);
-		if (rc < 0) {
-			LOGPFSML(ctx->fi, LOGL_ERROR,
-				"Failed to establish CTRL (neighbor resolution) connection to BSC r=%s:%u\n\n",
-				pcu->vty.neigh_ctrl_addr, pcu->vty.neigh_ctrl_port);
-			goto err_term;
-		}
-	}
-
-	cmd = ctrl_cmd_create(ctx, CTRL_TYPE_GET);
-	if (!cmd) {
-		LOGPFSML(ctx->fi, LOGL_ERROR, "CTRL msg creation failed\n");
-		goto err_term;
-	}
-
-	cmd->id = talloc_asprintf(cmd, "%u", arfcn_bsic_2_ctrl_id(ctx->neigh_key.tgt_arfcn,
-								  ctx->neigh_key.tgt_bsic));
-	cmd->variable = talloc_asprintf(cmd, "neighbor_resolve_cgi_ps_from_lac_ci.%d.%d.%d.%d",
-					ctx->neigh_key.local_lac, ctx->neigh_key.local_ci,
-					ctx->neigh_key.tgt_arfcn, ctx->neigh_key.tgt_bsic);
-	rc = ctrl_cmd_send(&ctx->neigh_ctrl_conn->write_queue, cmd);
-	if (rc) {
-		LOGPFSML(ctx->fi, LOGL_ERROR, "CTRL msg sent failed: %d\n", rc);
-		goto err_term;
-	}
-
-	talloc_free(cmd);
-	return 0;
-
-err_term:
-	talloc_free(cmd);
-	return -1;
-}
-
 static int send_neigh_addr_req(struct nacc_fsm_ctx *ctx)
 {
 	struct gprs_rlcmac_bts *bts = ctx->ms->bts;
 
-	/* If PCU was configured to use the old CTRL interface, use it: */
-	if (ctx->neigh_ctrl_conn)
-		return send_neigh_addr_req_ctrl_iface(ctx);
-
-	/* Otherwise, by default the new PCUIF over IPA Abis multiplex proto should be used: */
+	/* Using PCUIF over IPA Abis multiplex proto: */
 	return pcu_tx_neigh_addr_res_req(bts, &ctx->neigh_key);
 }
 
@@ -833,15 +781,6 @@
 		ctx->fi = NULL;
 	}
 
-	if (ctx->neigh_ctrl_conn) {
-		if (ctx->neigh_ctrl_conn->write_queue.bfd.fd != -1) {
-			osmo_wqueue_clear(&ctx->neigh_ctrl_conn->write_queue);
-			osmo_fd_unregister(&ctx->neigh_ctrl_conn->write_queue.bfd);
-			close(ctx->neigh_ctrl_conn->write_queue.bfd.fd);
-			ctx->neigh_ctrl_conn->write_queue.bfd.fd = -1;
-		}
-	}
-
 	return 0;
 }
 
@@ -859,19 +798,6 @@
 	if (!ctx->fi)
 		goto free_ret;
 
-	/* If CTRL ip present, use the old CTRL interface for neighbor resolution */
-	if (ms->bts->pcu->vty.neigh_ctrl_addr) {
-		ctx->neigh_ctrl = ctrl_handle_alloc(ctx, ctx, NULL);
-		ctx->neigh_ctrl->reply_cb = nacc_fsm_ctrl_reply_cb;
-		ctx->neigh_ctrl_conn = osmo_ctrl_conn_alloc(ctx, ctx->neigh_ctrl);
-		if (!ctx->neigh_ctrl_conn)
-			goto free_ret;
-		/* Older versions of osmo_ctrl_conn_alloc didn't properly initialize fd to -1,
-		 * so make sure to do it here otherwise fd may be valid fd 0 and cause trouble */
-		ctx->neigh_ctrl_conn->write_queue.bfd.fd = -1;
-		llist_add(&ctx->neigh_ctrl_conn->list_entry, &ctx->neigh_ctrl->ccon_list);
-	}
-
 	return ctx;
 free_ret:
 	talloc_free(ctx);
diff --git a/src/nacc_fsm.h b/src/nacc_fsm.h
index c051637..ec6db2e 100644
--- a/src/nacc_fsm.h
+++ b/src/nacc_fsm.h
@@ -46,8 +46,6 @@
 struct nacc_fsm_ctx {
 	struct osmo_fsm_inst *fi;
 	struct GprsMs* ms; /* back pointer */
-	struct ctrl_handle *neigh_ctrl;
-	struct ctrl_connection *neigh_ctrl_conn;
 	struct neigh_cache_entry_key neigh_key; /* target cell info from MS */
 	struct osmo_cell_global_id_ps cgi_ps; /* target cell info resolved from req_{arfcn+bsic} */
 	struct si_cache_value si_info; /* SI info resolved from SGSN, to be sent to MS */
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 54e0df6..84c0456 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -303,11 +303,6 @@
 	if (the_pcu->vty.ns_priority != -1)
 		vty_out(vty, " gb socket-priority %d%s", the_pcu->vty.ns_priority, VTY_NEWLINE);
 
-	if (the_pcu->vty.neigh_ctrl_addr) {
-		vty_out(vty, " neighbor resolution %s %u%s",
-			the_pcu->vty.neigh_ctrl_addr, the_pcu->vty.neigh_ctrl_port, VTY_NEWLINE);
-	}
-
 	osmo_tdef_vty_write(vty, the_pcu->T_defs, " timer ");
 
 	return CMD_SUCCESS;
@@ -1107,26 +1102,6 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_neighbor_resolution, cfg_neighbor_resolution_cmd,
-       "neighbor resolution " VTY_IPV46_CMD " [<0-65535>]",
-       "Manage local and remote-BSS neighbor cells\n"
-       "Connect to Neighbor Resolution Service (CTRL interface) to given ip and port\n"
-       "IPv4 address to connect to\n" "IPv6 address to connect to\n"
-       "Port to connect to (default 4248)\n")
-{
-	vty_out(vty, "%% Warning: The CTRL interface for Neighbor Address Resolution is now deprecated."
-		"Upgrade osmo-bsc and drop the 'neighbor resolution " VTY_IPV46_CMD " [<0-65535>]' VTY "
-		"option in order to let osmo-pcu use the new resoluton method using the PCUIF over IPA "
-		"multiplex, which will work out of the box without required configuration.%s", VTY_NEWLINE);
-	osmo_talloc_replace_string(the_pcu, &the_pcu->vty.neigh_ctrl_addr, argv[0]);
-	if (argc > 1)
-		the_pcu->vty.neigh_ctrl_port = atoi(argv[1]);
-	else
-		the_pcu->vty.neigh_ctrl_port = OSMO_CTRL_PORT_BSC_NEIGH;
-	return CMD_SUCCESS;
-}
-
-
 DEFUN(show_bts_timer, show_bts_timer_cmd,
       "show bts-timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
       SHOW_STR "Show BTS controlled timers\n"
@@ -1350,7 +1325,6 @@
 	install_element(PCU_NODE, &cfg_pcu_gb_dialect_cmd);
 	install_element(PCU_NODE, &cfg_pcu_gb_ip_dscp_cmd);
 	install_element(PCU_NODE, &cfg_pcu_gb_priority_cmd);
-	install_element(PCU_NODE, &cfg_neighbor_resolution_cmd);
 	install_element(PCU_NODE, &cfg_pcu_timer_cmd);
 
 	install_element_ve(&show_bts_stats_cmd);