aboutsummaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-05-02 21:55:31 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-05-05 16:11:05 +1000
commit29eb8e25cf0cb9f584bb95e8619e43375be71448 (patch)
tree9519cd3e682d746178e97f597823657d0bf593fe /clients
parent8870f4400f954ce9b9293eb30f27cecfa589cdba (diff)
downloadSLOF-29eb8e25cf0cb9f584bb95e8619e43375be71448.zip
SLOF-29eb8e25cf0cb9f584bb95e8619e43375be71448.tar.gz
SLOF-29eb8e25cf0cb9f584bb95e8619e43375be71448.tar.bz2
ipv6: Replace magic number 1500 with ETH_MTU_SIZE (i.e. 1518)
The whole ethernet frame can be up to 1518 bytes including the ethernet header. So this value should be used instead of 1500 when the whole ethernet packet is affected. Since we've already got a nice define for this value, use ETH_MTU_SIZE where it is appropriate. This patch also removes a "memset(n->eth_frame, 0, 1500)" in send_ipv6() to get rid of the magic value 1500 there -- it can be removed since the whole ethernet packet is filled into the buffer right after the memset, so there are no gaps that should be cleared first. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'clients')
-rw-r--r--clients/net-snk/app/netlib/ipv6.c3
-rw-r--r--clients/net-snk/app/netlib/ndp.h2
2 files changed, 2 insertions, 3 deletions
diff --git a/clients/net-snk/app/netlib/ipv6.c b/clients/net-snk/app/netlib/ipv6.c
index 6aa1ea3..300c913 100644
--- a/clients/net-snk/app/netlib/ipv6.c
+++ b/clients/net-snk/app/netlib/ipv6.c
@@ -501,7 +501,7 @@ int send_ipv6(int fd, void* buffer, int len)
memcpy(&ip_dst, &ip6h->dst, 16);
- if(len + sizeof(struct ethhdr) > 1500)
+ if(len + sizeof(struct ethhdr) > ETH_MTU_SIZE)
return -1;
if ( ip6_cmp (&ip6h->src, &null_ip6))
@@ -553,7 +553,6 @@ int send_ipv6(int fd, void* buffer, int len)
send_neighbour_solicitation (fd, &ip_dst);
// Store the packet until we know the MAC address
- memset(n->eth_frame, 0, 1500);
fill_ethhdr (n->eth_frame,
htons(ETHERTYPE_IPv6),
get_mac_address(),
diff --git a/clients/net-snk/app/netlib/ndp.h b/clients/net-snk/app/netlib/ndp.h
index 74fbd8b..7274f10 100644
--- a/clients/net-snk/app/netlib/ndp.h
+++ b/clients/net-snk/app/netlib/ndp.h
@@ -48,7 +48,7 @@ struct neighbor {
uint8_t times_asked;
/* ... */
struct neighbor *next;
- uint8_t eth_frame[1500]; //FIXME
+ uint8_t eth_frame[ETH_MTU_SIZE];
uint32_t eth_len;
#define NB_INCOMPLETE 1