Commit Graph

9 Commits

Author SHA1 Message Date
Pau Espin 46f04343a5 tests: in46a_test: Make coverity happy when calling in46a_from_eua
Coverity warns around that test code:
"Overrunning struct type in46_addr of 20 bytes by passing it to a
function which accesses it at byte offset 39."

That's basically because in64a_from_eua expects to be passed a 2 element
array to be filled. The second element, though, is only accessed in the
case where an IPv4v6 EUA is passed, so in the cases where the test
explicitly passes an IPv4 or IPv6 EUA it's not really an issue, hence
coverity throwing a false positive here.
Let's anyway rewrite the code to pass a 2 element array for completeness,
since it doesn't hurt and makes coverity happy.

Related: Coverity CID#249006
Change-Id: Idfc9104f48eeee6e7f11ebc5c17d4b0e4b2fe9e2
2022-02-09 09:41:46 +01:00
Pau Espin 51930f7b63 tests: Replace deprecated API log_set_print_filename
Change-Id: I35eb879d82e1030ea8be56ce9039277c021bb6fa
2021-02-19 13:23:00 +01:00
Pau Espin 042a445cf3 use osmo_init_logging2
Change-Id: Ic38fff17cc985238b91999c8acdd92d22fd28c72
2018-04-17 14:31:42 +02:00
Pau Espin 2d6a69e69a Add support for IPv4v6 End User Addresses
Before this commit, when an MS requested an ipv4v6 context osmo-ggsn
returned an error stating the type was unknown, and this text was
printed in the log:
Processing create PDP context request for APN 'ims'
Cannot decode EUA from MS/SGSN: f1 8d

This patch has been tested with an MS running the 3 types of addresses:
- IPv4 and IPv6: no regressions observed, the context is activated and
packets are sent to the ggsn.
- IPv4v6: Wireshark correctly parses request and reponse, and then
ICMPv6 traffic from both sides. Finally I see the MS using the IPv4 and
IPv6 DNS addresses advertised and TCP traffic over IPv4 (because
probably my IPv6 network setup is not correct). I also checked I can
disable/enable data (pdp ctx delete and activate) several times without
any issue.

Change-Id: Ic820759167fd3bdf329cb11d4b942e903fe50af5
2017-12-11 11:39:18 +01:00
Pau Espin 9c0f4f49e9 tests: Split ipv6 specific tests into a new test group
This way they can be easily disabled later on when IPv6 support is made
optional.

Change-Id: I3906dbf55ccf1650083398e08ac870add0bbdcef
2017-12-04 13:25:02 +01:00
Neels Hofmeyr 1d85bea152 sanitize build: ensure uint16/32 alignment in gtpie_test and in46a_test
Fixes sanitize build failures:

  Testing gtpie_tlv()
  ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:30:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint16_t', which requires 2 byte alignment
  0x55c0a0830f21: note: pointer points here
   00 00 00  17 00 06 01 02 03 04 05  06 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
                ^
  Testing gtpie_tv0()
  Testing gtpie_tv1()
  Testing gtpie_tv2()
  ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:76:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint16_t', which requires 2 byte alignment
  0x55c0a0830f21: note: pointer points here
   00 00 00  2a ab cd 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
                ^
  Testing gtpie_tv4()
  ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:90:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint32_t', which requires 4 byte alignment
  0x55c0a0830f21: note: pointer points here
   00 00 00  2a ab cd 01 23 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
                ^
  Testing gtpie_tv8()
  ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:104:2: runtime error: load of misaligned address 0x55c0a0830f21 for type 'uint32_t', which requires 4 byte alignment
  0x55c0a0830f21: note: pointer points here
   00 00 00  2a 00 01 02 03 04 05 06  07 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
                ^
  ../../../../src/osmo-ggsn/tests/gtp/gtpie_test.c:105:2: runtime error: load of misaligned address 0x55c0a0830f25 for type 'uint32_t', which requires 4 byte alignment
  0x55c0a0830f25: note: pointer points here
   00 01 02 03 04 05 06  07 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00
               ^

Change-Id: I9eb16450af942d6464211e190f6a4d5a1d814842
2017-11-29 16:20:57 +00:00
Neels Hofmeyr dabb8b4860 fix compiler warnings: return 0 in main(), in 3 tests
Change-Id: I9e49ceba6b0a8dffd331e5707667d9bb007f3ec7
2017-10-31 01:02:00 +01:00
Pau Espin 2e7b9ff891 lib/in46a: Introduce in46a_netmasklen API
Change-Id: I06e3e038afd8f7afaec2a3fa67b1616500c8db80
2017-10-16 17:45:40 +02:00
Harald Welte db924d3908 Add unit tests for lib/in46_addr.c code
Change-Id: Id032c330405e5dca8ecfc0970d128341ed75c675
2017-10-13 16:36:39 +02:00