packets: fix compose_nd to not crash system
authorThadeu Lima de Souza Cascardo <cascardo@redhat.com>
Fri, 5 Feb 2016 10:33:32 +0000 (08:33 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@redhat.com>
Thu, 10 Mar 2016 17:03:57 +0000 (14:03 -0300)
commit7a6078f0122271f97944ed9a9db4d134badff676
tree3b08554c0294674036ad040876fad2346dda3581
parent62c8c056500bb7c8908d6eea07ae29cd651b9e57
packets: fix compose_nd to not crash system

packet_set_ipv6 and packet_set_nd assumed that valid packets were already in
place, so they were not a good fit for composing new packets. In fact,
packet_set_ipv6 didn't even set the IP version or set L4 offset, causing crashes
when compose_nd tried to access L4.

This patch introduces ipv6_compose and uses it for compose_nd, then set the ND
packets without other helpers.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
lib/packets.c
lib/packets.h