gprs_ns2: ensure no duplicate UDP NSVC can be created
Change-Id: I58a95817e2730bbbaa851a43a5b072d1de2db037
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 4bd7cde..6214907 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1093,6 +1093,15 @@
goto err;
}
+ nsvc = gprs_ns2_nsvc_by_sockaddr_bind(bind, &remote);
+ if (nsvc) {
+ if (nsvc->nse == nse)
+ vty_out(vty, "Specified NSVC is already present in this NSE.%s", VTY_NEWLINE);
+ else
+ vty_out(vty, "Specified NSVC is already present in another NSE%05u.%s", nsvc->nse->nsei, VTY_NEWLINE);
+ goto err;
+ }
+
nsvc = gprs_ns2_ip_connect(bind, &remote, nse, 0);
if (!nsvc) {
vty_out(vty, "Can not create NS-VC.%s", VTY_NEWLINE);