Skip to content

Commit

Permalink
net: ipv6: Prefix length was incorrectly set
Browse files Browse the repository at this point in the history
The IPv6 prefix address length was incorrectly set in net_if
after RA was received from the network. The incorrect "len"
variable was used instead of correct "prefix_len" in the prefix
info struct.

Change-Id: Ifeaf150b9960414d2ad200053a3bd5290dc8d365
Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar committed Mar 17, 2017
1 parent 51dea40 commit 0a259d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions subsys/net/ip/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,16 +1908,16 @@ static inline void handle_prefix_onlink(struct net_buf *buf,

prefix = net_if_ipv6_prefix_lookup(net_nbuf_iface(buf),
&prefix_info->prefix,
prefix_info->len);
prefix_info->prefix_len);
if (!prefix) {
if (!prefix_info->valid_lifetime) {
return;
}

prefix = net_if_ipv6_prefix_add(net_nbuf_iface(buf),
&prefix_info->prefix,
prefix_info->len,
prefix_info->valid_lifetime);
&prefix_info->prefix,
prefix_info->prefix_len,
prefix_info->valid_lifetime);
if (prefix) {
NET_DBG("Interface %p add prefix %s/%d lifetime %u",
net_nbuf_iface(buf),
Expand All @@ -1927,7 +1927,7 @@ static inline void handle_prefix_onlink(struct net_buf *buf,
} else {
NET_ERR("Prefix %s/%d could not be added to iface %p",
net_sprint_ipv6_addr(&prefix_info->prefix),
prefix_info->len,
prefix_info->prefix_len,
net_nbuf_iface(buf));

return;
Expand All @@ -1939,7 +1939,7 @@ static inline void handle_prefix_onlink(struct net_buf *buf,
NET_DBG("Interface %p delete prefix %s/%d",
net_nbuf_iface(buf),
net_sprint_ipv6_addr(&prefix_info->prefix),
prefix_info->len);
prefix_info->prefix_len);

net_if_ipv6_prefix_rm(net_nbuf_iface(buf),
&prefix->prefix,
Expand Down

0 comments on commit 0a259d6

Please sign in to comment.