contiki-os/contiki — pull request #898 by g-oikonomou (2014-12-08 22:10:02+00:00)
Title: Fill IPv6->Next-Hdr field for outgoing RSTs

Under some conditions (more below) we send out a TCP RST segment, but we forget to set IPv6->Next-Hdr, resulting in a broken datagram at layer 3 (has next header = 0 .

This pull fixes the issue

To reproduce (Node A is a Contiki node, node B is a TCP listener somewhere)
* Node A connects to B. B can be a netcat listener
* Node A resets (e.g. to update the firmware or by a user reset etc)
* Node A tries to connect to B again
* B identifies that the old connection needs closed and sends a TCP FIN
* A cannot find an active session for this FIN and tries to reply with RST

The comments in `uip6.c` suggest that this is exactly what we want to be doing.

```
/* If we didn't find and active connection that expected the packet,
either this packet is an old duplicate, or this is a SYN packet
destined for a connection in LISTEN. If the SYN flag isn't set,
it is an old packet and we send a RST. */
```

But in this particular execution branch, we don't set "Next Header = TCP", the datagram gets sent with the next header == 0.