lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201019114708.1050421-1-zahari.doychev@linux.com>
Date:   Mon, 19 Oct 2020 13:47:08 +0200
From:   Zahari Doychev <zahari.doychev@...ux.com>
To:     netdev@...r.kernel.org
Cc:     dsahern@...il.com, simon.horman@...ronome.com, jhs@...atatu.com,
        Zahari Doychev <zahari.doychev@...ux.com>
Subject: [iproute2-next] tc flower: use right ethertype in icmp/arp parsing

Currently the icmp and arp prsing functions are called with inccorect
ethtype in case of vlan or cvlan filter options. In this case either
cvlan_ethtype or vlan_ethtype has to be used.

Signed-off-by: Zahari Doychev <zahari.doychev@...ux.com>
---
 tc/f_flower.c | 43 ++++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/tc/f_flower.c b/tc/f_flower.c
index 00c919fd..dd9f3446 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -1712,7 +1712,10 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
 			}
 		} else if (matches(*argv, "type") == 0) {
 			NEXT_ARG();
-			ret = flower_parse_icmp(*argv, eth_type, ip_proto,
+			ret = flower_parse_icmp(*argv, cvlan_ethtype ?
+						cvlan_ethtype : vlan_ethtype ?
+						vlan_ethtype : eth_type,
+						ip_proto,
 						FLOWER_ICMP_FIELD_TYPE, n);
 			if (ret < 0) {
 				fprintf(stderr, "Illegal \"icmp type\"\n");
@@ -1720,7 +1723,10 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
 			}
 		} else if (matches(*argv, "code") == 0) {
 			NEXT_ARG();
-			ret = flower_parse_icmp(*argv, eth_type, ip_proto,
+			ret = flower_parse_icmp(*argv, cvlan_ethtype ?
+						cvlan_ethtype : vlan_ethtype ?
+						vlan_ethtype : eth_type,
+						ip_proto,
 						FLOWER_ICMP_FIELD_CODE, n);
 			if (ret < 0) {
 				fprintf(stderr, "Illegal \"icmp code\"\n");
@@ -1728,33 +1734,36 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
 			}
 		} else if (matches(*argv, "arp_tip") == 0) {
 			NEXT_ARG();
-			ret = flower_parse_arp_ip_addr(*argv, vlan_ethtype ?
-						       vlan_ethtype : eth_type,
-						       TCA_FLOWER_KEY_ARP_TIP,
-						       TCA_FLOWER_KEY_ARP_TIP_MASK,
-						       n);
+			ret = flower_parse_arp_ip_addr(*argv, cvlan_ethtype ?
+						cvlan_ethtype : vlan_ethtype ?
+						vlan_ethtype : eth_type,
+						TCA_FLOWER_KEY_ARP_TIP,
+						TCA_FLOWER_KEY_ARP_TIP_MASK,
+						n);
 			if (ret < 0) {
 				fprintf(stderr, "Illegal \"arp_tip\"\n");
 				return -1;
 			}
 		} else if (matches(*argv, "arp_sip") == 0) {
 			NEXT_ARG();
-			ret = flower_parse_arp_ip_addr(*argv, vlan_ethtype ?
-						       vlan_ethtype : eth_type,
-						       TCA_FLOWER_KEY_ARP_SIP,
-						       TCA_FLOWER_KEY_ARP_SIP_MASK,
-						       n);
+			ret = flower_parse_arp_ip_addr(*argv, cvlan_ethtype ?
+						cvlan_ethtype : vlan_ethtype ?
+						vlan_ethtype : eth_type,
+						TCA_FLOWER_KEY_ARP_SIP,
+						TCA_FLOWER_KEY_ARP_SIP_MASK,
+						n);
 			if (ret < 0) {
 				fprintf(stderr, "Illegal \"arp_sip\"\n");
 				return -1;
 			}
 		} else if (matches(*argv, "arp_op") == 0) {
 			NEXT_ARG();
-			ret = flower_parse_arp_op(*argv, vlan_ethtype ?
-						  vlan_ethtype : eth_type,
-						  TCA_FLOWER_KEY_ARP_OP,
-						  TCA_FLOWER_KEY_ARP_OP_MASK,
-						  n);
+			ret = flower_parse_arp_op(*argv,  cvlan_ethtype ?
+						cvlan_ethtype : vlan_ethtype ?
+						vlan_ethtype : eth_type,
+						TCA_FLOWER_KEY_ARP_OP,
+						TCA_FLOWER_KEY_ARP_OP_MASK,
+						n);
 			if (ret < 0) {
 				fprintf(stderr, "Illegal \"arp_op\"\n");
 				return -1;
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ