net: core: Remove duplicate calls
If the buffer contains IPv6 header, set header length only once. Need not to set it in different scenarios. Change-Id: I54ab9a4259851c9230db240f6091e3190d25b6cb Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
parent
3fd8305d6a
commit
89b7bbfcfd
@ -232,6 +232,7 @@ static inline enum net_verdict process_ipv6_pkt(struct net_buf *buf)
|
||||
net_nbuf_set_next_hdr(buf, &hdr->nexthdr);
|
||||
net_nbuf_set_ext_len(buf, 0);
|
||||
net_nbuf_set_ext_bitmap(buf, 0);
|
||||
net_nbuf_set_ip_hdr_len(buf, sizeof(struct net_ipv6_hdr));
|
||||
|
||||
/* Fast path for main upper layer protocols. The handling of extension
|
||||
* headers can be slow so do this checking here. There cannot
|
||||
@ -239,17 +240,14 @@ static inline enum net_verdict process_ipv6_pkt(struct net_buf *buf)
|
||||
*/
|
||||
switch (*(net_nbuf_next_hdr(buf))) {
|
||||
case IPPROTO_ICMPV6:
|
||||
net_nbuf_set_ip_hdr_len(buf, sizeof(struct net_ipv6_hdr));
|
||||
return process_icmpv6_pkt(buf, hdr);
|
||||
|
||||
#if defined(CONFIG_NET_UDP)
|
||||
case IPPROTO_UDP:
|
||||
net_nbuf_set_ip_hdr_len(buf, sizeof(struct net_ipv6_hdr));
|
||||
return net_conn_input(IPPROTO_UDP, buf);
|
||||
#endif
|
||||
#if defined(CONFIG_NET_TCP)
|
||||
case IPPROTO_TCP:
|
||||
net_nbuf_set_ip_hdr_len(buf, sizeof(struct net_ipv6_hdr));
|
||||
return net_conn_input(IPPROTO_TCP, buf);
|
||||
#endif
|
||||
}
|
||||
@ -333,8 +331,6 @@ static inline enum net_verdict process_ipv6_pkt(struct net_buf *buf)
|
||||
net_nbuf_set_ext_len(buf,
|
||||
offset -
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
net_nbuf_set_ip_hdr_len(buf,
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
return process_icmpv6_pkt(buf, hdr);
|
||||
|
||||
#if defined(CONFIG_NET_UDP)
|
||||
@ -342,8 +338,6 @@ static inline enum net_verdict process_ipv6_pkt(struct net_buf *buf)
|
||||
net_nbuf_set_ext_len(buf,
|
||||
offset -
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
net_nbuf_set_ip_hdr_len(buf,
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
return net_conn_input(IPPROTO_UDP, buf);
|
||||
#endif
|
||||
#if defined(CONFIG_NET_TCP)
|
||||
@ -351,8 +345,6 @@ static inline enum net_verdict process_ipv6_pkt(struct net_buf *buf)
|
||||
net_nbuf_set_ext_len(buf,
|
||||
offset -
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
net_nbuf_set_ip_hdr_len(buf,
|
||||
sizeof(struct net_ipv6_hdr));
|
||||
return net_conn_input(IPPROTO_TCP, buf);
|
||||
#endif
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user