diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-10-14 11:13:56 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-10-14 11:13:56 +0200 |
commit | 68bc34c0e88b6eff8279201bdc2d16dab7a4dd68 (patch) | |
tree | a9308afc1de52aee200906969bd2ee98f53ee335 | |
parent | de964cc2a201e442ddcd27f91ed6eef1a096c3b6 (diff) |
csum: Remove unnecessary memset in p4_csum()
No need to memset the IPv4 pseudo header to 0 as all its members will
explicitly be set. Also reorder the setting of the pseudo header to
match the order of the fields.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | csum.h | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -156,12 +156,11 @@ static inline uint16_t p4_csum(const struct ip *ip, const uint8_t *data, uint16_t len; } ph; - memset(&ph, 0, sizeof(ph)); - ph.len = htons(len); - ph.mbz = 0; - ph.proto = next_proto; ph.src = ip->ip_src.s_addr; ph.dst = ip->ip_dst.s_addr; + ph.mbz = 0; + ph.proto = next_proto; + ph.len = htons(len); vec[0].ptr = (const uint8_t *) (void *) &ph; vec[0].len = sizeof(ph); |