Skip to content

Commit 7f5a481

Browse files
kderdacarlescufi
authored andcommitted
net: ipv6: mld: remove addition of unspecified source in MLDv2 report
From RFC: * "source list" is an unordered list of zero or more unicast addresses from which multicast reception is desired or not desired [...] It means that there is no need to add any special address to specify "block all" and "allow all" states explicitly. This commit removes the unnecessary addition. Signed-off-by: Konrad Derda <[email protected]>
1 parent cdc7693 commit 7f5a481

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

subsys/net/ip/ipv6_mld.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ struct mcast_route_appending_info {
4848

4949
static int mld_create(struct net_pkt *pkt,
5050
const struct in6_addr *addr,
51-
uint8_t record_type,
52-
uint16_t num_sources)
51+
uint8_t record_type)
5352
{
5453
NET_PKT_DATA_ACCESS_DEFINE(mld_access,
5554
struct net_icmpv6_mld_mcast_record);
@@ -63,23 +62,14 @@ static int mld_create(struct net_pkt *pkt,
6362

6463
mld->record_type = record_type;
6564
mld->aux_data_len = 0U;
66-
mld->num_sources = htons(num_sources);
65+
mld->num_sources = 0U;
6766

6867
net_ipv6_addr_copy_raw(mld->mcast_address, (uint8_t *)addr);
6968

7069
if (net_pkt_set_data(pkt, &mld_access)) {
7170
return -ENOBUFS;
7271
}
7372

74-
if (num_sources > 0) {
75-
/* All source addresses, RFC 3810 ch 3 */
76-
if (net_pkt_write(pkt,
77-
net_ipv6_unspecified_address()->s6_addr,
78-
sizeof(struct in6_addr))) {
79-
return -ENOBUFS;
80-
}
81-
}
82-
8373
return 0;
8474
}
8575

@@ -181,7 +171,7 @@ static void append_mcast_routes(struct net_route_entry_mcast *entry, void *user_
181171
}
182172
}
183173

184-
info->status = mld_create(info->pkt, &entry->group, NET_IPV6_MLDv2_MODE_IS_EXCLUDE, 0);
174+
info->status = mld_create(info->pkt, &entry->group, NET_IPV6_MLDv2_MODE_IS_EXCLUDE);
185175
}
186176
#endif
187177

@@ -201,7 +191,7 @@ int net_ipv6_mld_send_single(struct net_if *iface, const struct in6_addr *addr,
201191
}
202192

203193
if (mld_create_packet(pkt, 1) ||
204-
mld_create(pkt, addr, mode, 1)) {
194+
mld_create(pkt, addr, mode)) {
205195
ret = -ENOBUFS;
206196
goto drop;
207197
}
@@ -337,7 +327,7 @@ static int send_mld_report(struct net_if *iface)
337327
}
338328

339329
ret = mld_create(pkt, &ipv6->mcast[i].address.in6_addr,
340-
NET_IPV6_MLDv2_MODE_IS_EXCLUDE, 0);
330+
NET_IPV6_MLDv2_MODE_IS_EXCLUDE);
341331
if (ret < 0) {
342332
goto drop;
343333
}

0 commit comments

Comments
 (0)