net-snk: Remove bad NEIGHBOUR_SOLICITATION code in send_ipv6()

The code that checks for NEIGHBOUR_SOLICITATION packets is bad
in two ways: First, it does not check that the packet is really
an ICMPv6 packet, so it could accidentially be triggered for UDP
or TCP packets, too. Second, the fill_ethhdr() is redundant (since
it is done at the end of the function again) and also wrong (it
uses the wrong buffer pointer to fill in the ethernet header).

All we really need here is to get the right MAC address via
ip6_to_multicast_mac() - and this is handled in the following
if-statement already (NEIGHBOUR_SOLICITATIONs are always sent
as multicast in the send_neighbour_solicitation() function), so
the bad code block can simply be removed to fix the two issues.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
Thomas Huth 2016-01-15 18:36:34 +01:00 committed by Alexey Kardashevskiy
parent fe7b047c0c
commit c74ddc9954
1 changed files with 1 additions and 9 deletions

View File

@ -530,16 +530,8 @@ send_ipv6 (int fd, void* buffer, int len)
n = find_neighbor (&ip_dst);
// If packet is a neighbor solicitation
if (icmp6h->type == ICMPV6_NEIGHBOUR_SOLICITATION) {
mac_addr = ip6_to_multicast_mac (&ip_dst);
fill_ethhdr( buffer-sizeof(struct ethhdr), htons(ETHERTYPE_IPv6),
get_mac_address(),
mac_addr);
}
// If address is a multicast address, create a proper mac address
else if (ip6_is_multicast (&ip_dst)) {
if (ip6_is_multicast (&ip_dst)) {
mac_addr = ip6_to_multicast_mac (&ip_dst);
}
else {