diff options
author | Thomas Huth <thuth@redhat.com> | 2016-04-07 12:09:54 +0200 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-04-12 13:47:47 +1000 |
commit | 02facda6a5078b2f28a14d4a18f9f1182dd5e128 (patch) | |
tree | 981ec6d7deb706a9261d2931c5a85dade66fb41c /clients | |
parent | c006b3827032e9f5a886758316d516eca4354d02 (diff) | |
download | SLOF-02facda6a5078b2f28a14d4a18f9f1182dd5e128.zip SLOF-02facda6a5078b2f28a14d4a18f9f1182dd5e128.tar.gz SLOF-02facda6a5078b2f28a14d4a18f9f1182dd5e128.tar.bz2 |
ipv6: send_ipv6() has to return after doing NDP
The send_ipv6() function should return after doing NDP, since either
the queued packet got send out during handle_na() already, or it has
been stored to be sent out later (once the neighbor advertisment has
been received). If we don't return here, the code runs into the final
send_ether() here later, which then sends out the packet a second time.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'clients')
-rw-r--r-- | clients/net-snk/app/netlib/icmpv6.c | 2 | ||||
-rw-r--r-- | clients/net-snk/app/netlib/ipv6.c | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/clients/net-snk/app/netlib/icmpv6.c b/clients/net-snk/app/netlib/icmpv6.c index c104f70..ad3f994 100644 --- a/clients/net-snk/app/netlib/icmpv6.c +++ b/clients/net-snk/app/netlib/icmpv6.c @@ -336,7 +336,7 @@ handle_na (int fd, uint8_t *packet) return 0; } else { memcpy (&(n->mac), &(headers.ethh->src_mac[0]), 6); - + n->status = NB_REACHABLE; if (n->eth_len > 0) { struct ethhdr * ethh = (struct ethhdr *) &(n->eth_frame); memcpy(ethh->dest_mac, &(n->mac), 6); diff --git a/clients/net-snk/app/netlib/ipv6.c b/clients/net-snk/app/netlib/ipv6.c index 5a307ca..00912ca 100644 --- a/clients/net-snk/app/netlib/ipv6.c +++ b/clients/net-snk/app/netlib/ipv6.c @@ -478,8 +478,10 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned short *packet, * @param fd socket fd * @param ip6_packet Pointer to IPv6 header in packet * @param packetsize Size of IPv6 packet - * @return -1 == ERRROR - * return of handle_udp() or handle_icmp6() + * @return -1 : Some error occured + * 0 : packet stored (NDP request sent - packet will be sent if + * NDP response is received) + * >0 : packet sent (number of transmitted bytes is returned) * * @see receive_ether * @see ip6hdr @@ -562,7 +564,10 @@ int send_ipv6(int fd, void* buffer, int len) set_timer(TICKS_SEC); do { receive_ether(fd); + if (n->status == NB_REACHABLE) + return len; } while (get_timer() > 0); + return 0; } } } |