Skip to content
Permalink
Browse files

net/ipv4: Remove useless proto field setting in ipv4 header

No need to initialize it to 0 as it will be set through given parameter.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
  • Loading branch information...
tbursztyka authored and jukkar committed Jul 23, 2018
1 parent d147cc8 commit df4325a9b80a606744c08bf7644403c887a1cff2
Showing with 1 addition and 3 deletions.
  1. +1 −3 subsys/net/ip/ipv4.c
@@ -41,7 +41,7 @@ struct net_pkt *net_ipv4_create(struct net_pkt *pkt,

NET_IPV4_HDR(pkt)->vhl = 0x45;
NET_IPV4_HDR(pkt)->tos = 0x00;
NET_IPV4_HDR(pkt)->proto = 0;
NET_IPV4_HDR(pkt)->proto = next_header_proto;

/* User can tweak the default TTL if needed */
NET_IPV4_HDR(pkt)->ttl = net_pkt_ipv4_ttl(pkt);
@@ -55,8 +55,6 @@ struct net_pkt *net_ipv4_create(struct net_pkt *pkt,
net_ipaddr_copy(&NET_IPV4_HDR(pkt)->dst, dst);
net_ipaddr_copy(&NET_IPV4_HDR(pkt)->src, src);

NET_IPV4_HDR(pkt)->proto = next_header_proto;

net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv4_hdr));
net_pkt_set_family(pkt, AF_INET);

0 comments on commit df4325a

Please sign in to comment.
You can’t perform that action at this time.