Fix these build errors, which are generated if DEBUG is set to 1:
../../core/net/llsec/noncoresec/noncoresec.c: In function 'parse':
../../core/net/llsec/noncoresec/noncoresec.c:198:54: error: expected ')' before 'PRIu32'
PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
../../core/net/llsec/noncoresec/noncoresec.c:198:12: warning: spurious trailing '%' in format [-Wformat=]
PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
../../core/net/llsec/noncoresec/noncoresec.c:198:12: warning: spurious trailing '%' in format [-Wformat=]
PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
../../core/net/llsec/noncoresec/noncoresec.c:231:54: error: expected ')' before 'PRIu32'
PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
../../core/net/llsec/noncoresec/noncoresec.c:231:15: warning: spurious trailing '%' in format [-Wformat=]
PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
../../core/net/llsec/noncoresec/noncoresec.c:231:15: warning: spurious trailing '%' in format [-Wformat=]
PRINTF("noncoresec: received replayed frame %"PRIu32"\n",
^
../../core/net/llsec/noncoresec/noncoresec.c:88:28: note: in definition of macro 'PRINTF'
#define PRINTF(...) printf(__VA_ARGS__)
^
PRIu32 is not defined, so replace it with a standard format directive.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
When an UDP packet too big to fit in the uIP packet buffer is to be sent, the part fitting in the uIP buffer is copied to it (so no buffer overflow occurs) but uIP actually sends a packet of the original size therefore a buffer over-read occurs.
This modification makes uIP discard the UDP packets that do not fit in the uIP packet buffer.
Change certain CPP conditionals into C conditionals, which should be possible for the compiler to optimize at runtime. This makes the source code easier to read.
According to RFC 2460 the length field of the Hop-by-Hop options header
should use a 8-octet unit (multiple of 8 byte).
In a normal configuration the RPL_HOP_BY_HOP_LEN define is 8, so the
current implementation works, but if RPL_HOP_BY_HOP_LEN is a multiple
of 8 the length is not calculated correctly.