Skip to content

Commit aa9bea0

Browse files
Kittipon Meesompopdavem330
authored andcommitted
s390/qeth: reject multicast rxip addresses
There exist different commands to add unicast and multicast addresses on the OSA card. rxip addresses are always set as unicast addresses and thus just unicast addresses should be allowed. Adding a multicast address now fails and a grace message is generated. Signed-off-by: Kittipon Meesompop <[email protected]> Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d65626a commit aa9bea0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/s390/net/qeth_l3_sys.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,26 @@ static ssize_t qeth_l3_dev_rxip_add4_show(struct device *dev,
895895
static int qeth_l3_parse_rxipe(const char *buf, enum qeth_prot_versions proto,
896896
u8 *addr)
897897
{
898+
__be32 ipv4_addr;
899+
struct in6_addr ipv6_addr;
900+
898901
if (qeth_l3_string_to_ipaddr(buf, proto, addr)) {
899902
return -EINVAL;
900903
}
904+
if (proto == QETH_PROT_IPV4) {
905+
memcpy(&ipv4_addr, addr, sizeof(ipv4_addr));
906+
if (ipv4_is_multicast(ipv4_addr)) {
907+
QETH_DBF_MESSAGE(2, "multicast rxip not supported.\n");
908+
return -EINVAL;
909+
}
910+
} else if (proto == QETH_PROT_IPV6) {
911+
memcpy(&ipv6_addr, addr, sizeof(ipv6_addr));
912+
if (ipv6_addr_is_multicast(&ipv6_addr)) {
913+
QETH_DBF_MESSAGE(2, "multicast rxip not supported.\n");
914+
return -EINVAL;
915+
}
916+
}
917+
901918
return 0;
902919
}
903920

0 commit comments

Comments
 (0)