gprs_ns2: fr: check the device state before changing state
Reduce the required capabilities if the device is already
set up.
Change-Id: I72eb2567078758694c648a493324b212461ee735
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 1b0ec00..e972a34 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -447,6 +447,13 @@
memset(&req, 0, sizeof req);
OSMO_STRLCPY_ARRAY(req.ifr_name, netif);
+ rc = ioctl(sock, SIOCGIFFLAGS, &req);
+ if (rc < 0)
+ return rc;
+
+ if ((req.ifr_flags & IFF_UP) == up)
+ return 0;
+
if (up)
req.ifr_flags |= IFF_UP;