For strncat, to obtain n, one must not subtract the length of what is appended,
but the length of what is already written from the buffer size.
Verified with this little test program:
#include <stdio.h>
#include <string.h>
int main() {
char buf[20];
strncpy(buf, "123", 10);
strncat(buf, "456789012345", 10 - strlen(buf));
printf("%s\n", buf);
return 0;
}
It prints "1234567890".
---
gtp/gtp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 12cb492..55a8ce4 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -650,7 +650,7 @@ static void log_restart(struct gsn_t *gsn)
filename[NAMESIZE - 1] = 0; /* No null term. guarantee by strncpy */
strncpy(filename, gsn->statedir, NAMESIZE - 1);
- strncat(filename, RESTART_FILE, NAMESIZE - 1 - sizeof(RESTART_FILE));
+ strncat(filename, RESTART_FILE, NAMESIZE - 1 - strlen(filename));
i = umask(022);
--
2.1.4
---
gtp/gtpie.c | 3 +++
gtp/gtpie.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/gtp/gtpie.c b/gtp/gtpie.c
index a45df1c..c8db449 100644
--- a/gtp/gtpie.c
+++ b/gtp/gtpie.c
@@ -243,6 +243,7 @@ int gtpie_decaps(union gtpie_member *ie[], int version,
void *pack,
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
+ case GTPIE_BCM:
if (j < GTPIE_SIZE) {
ie[j] = (union gtpie_member *)p;
if (GTPIE_DEBUG)
@@ -457,6 +458,7 @@ int gtpie_encaps(union gtpie_member *ie[], void *pack,
unsigned *len)
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
+ case GTPIE_BCM:
iesize = 2;
break;
case GTPIE_FL_DI: /* TV GTPIE types with value length 2 */
@@ -558,6 +560,7 @@ int gtpie_encaps2(union gtpie_member ie[], unsigned int
size,
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
+ case GTPIE_BCM:
iesize = 2;
break;
case GTPIE_PFI: /* TV GTPIE types with value length 2 */
diff --git a/gtp/gtpie.h b/gtp/gtpie.h
index 340a76c..fb8598e 100644
--- a/gtp/gtpie.h
+++ b/gtp/gtpie.h
@@ -106,6 +106,7 @@ static __inline uint64_t hton64(uint64_t q)
#define GTPIE_USER_LOC 152 /* User Location Information */
#define GTPIE_MS_TZ 153 /* MS Time Zone */
#define GTPIE_IMEI_SV 154 /* IMEI Software Version */
+#define GTPIE_BCM 184 /* Bearer control mode */
/* 239-250 Reserved for the GPRS charging protocol (see GTP' in GSM 12.15)
*/
#define GTPIE_CHARGING_ADDR 251 /* Charging Gateway Address */
/* 252-254 Reserved for the GPRS charging protocol (see GTP' in GSM 12.15)
*/
--
2.8.2.windows.1
Hello.
sgsnemu cannot establish PDP context with latest Cisco GGSN.
There is additional information element "Bearer control mode" sent by GGSN
in create PDP context response message (attachment).
This information element is not recognized by sgsnemu.
Here are the changes in libgtp to support this information element:
9 gtp/gtpie.c
@@ -243,7 +243,8 @@ int gtpie_decaps(union gtpie_member *ie[], int
version, void *pack,
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
- if (j < GTPIE_SIZE) {
+ case GTPIE_BCM:
+ if (j < GTPIE_SIZE) {
ie[j] = (union gtpie_member *)p;
if (GTPIE_DEBUG)
printf
@@ -457,7 +458,8 @@ int gtpie_encaps(union gtpie_member *ie[], void *pack,
unsigned *len)
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
- iesize = 2;
+ case GTPIE_BCM:
+ iesize = 2;
break;
case GTPIE_FL_DI: /* TV GTPIE types with value length 2 */
case GTPIE_FL_C:
@@ -558,7 +560,8 @@ int gtpie_encaps2(union gtpie_member ie[], unsigned
int size,
case GTPIE_RP_SMS:
case GTPIE_RP:
case GTPIE_MS_NOT_REACH:
- iesize = 2;
+ case GTPIE_BCM:
+ iesize = 2;
break;
case GTPIE_PFI: /* TV GTPIE types with value length 2 */
case GTPIE_CHARGING_C:
1 gtp/gtpie.h
@@ -106,6 +106,7 @@ static __inline uint64_t hton64(uint64_t q)
#define GTPIE_USER_LOC 152 /* User Location Information */
#define GTPIE_MS_TZ 153 /* MS Time Zone */
#define GTPIE_IMEI_SV 154 /* IMEI Software Version */
+#define GTPIE_BCM 184 /* Bearer control mode */
/* 239-250 Reserved for the GPRS charging protocol (see GTP' in GSM
12.15) */
#define GTPIE_CHARGING_ADDR 251 /* Charging Gateway Address */
/* 252-254 Reserved for the GPRS charging protocol (see GTP' in GSM
12.15) */
--
Hi All,
Unit test execution of current master of osmo-pcu(9bbe1600cc02e1b538380393edb1dcdabe9247a2<https://git.osmocom.org/osmo-pcu/commit/?id=9bbe1600cc02e1b538380393edb1dcd…>) is getting failed with below description
regression tests
1: rlcmac ok
2: ts_alloc ok
3: tbf FAILED (testsuite.at:23)
4: edge ok
5: types ok
6: ms ok
7: llc ok
8: llist ok
9: codel ok
## ------------- ##
## Test results. ##
## ------------- ##
ERROR: All 9 tests were run,
1 failed unexpectedly.
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##
Possible Reason being TbfTest.err is not updated
Thanks,
Aravind Sirsikar
Hi,
it looks like after the rebase done by gerrit something didn't compile anymore. Could someone please have a look at https://gerrit.osmocom.org/#/c/429/ and fix the fall-out in master?
thank you
holger
Hello Max,
> What about MCS UL? Do you have some statistics which one has been used
The uplink tests have been completed for all EGPRS coding scheme (MCS1 - 9) using the ping or TCP download.
We have not conducted specific test for throughput estimation in uplink direction till now.
Regards
Saurabh