aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/qeth.h')
-rw-r--r--drivers/s390/net/qeth.h77
1 files changed, 59 insertions, 18 deletions
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 38a2441564d7..d238c7ed103b 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -8,6 +8,7 @@
8#include <linux/trdevice.h> 8#include <linux/trdevice.h>
9#include <linux/etherdevice.h> 9#include <linux/etherdevice.h>
10#include <linux/if_vlan.h> 10#include <linux/if_vlan.h>
11#include <linux/ctype.h>
11 12
12#include <net/ipv6.h> 13#include <net/ipv6.h>
13#include <linux/in6.h> 14#include <linux/in6.h>
@@ -24,7 +25,7 @@
24 25
25#include "qeth_mpc.h" 26#include "qeth_mpc.h"
26 27
27#define VERSION_QETH_H "$Revision: 1.142 $" 28#define VERSION_QETH_H "$Revision: 1.152 $"
28 29
29#ifdef CONFIG_QETH_IPV6 30#ifdef CONFIG_QETH_IPV6
30#define QETH_VERSION_IPV6 ":IPv6" 31#define QETH_VERSION_IPV6 ":IPv6"
@@ -718,8 +719,6 @@ struct qeth_reply {
718 atomic_t refcnt; 719 atomic_t refcnt;
719}; 720};
720 721
721#define QETH_BROADCAST_WITH_ECHO 1
722#define QETH_BROADCAST_WITHOUT_ECHO 2
723 722
724struct qeth_card_blkt { 723struct qeth_card_blkt {
725 int time_total; 724 int time_total;
@@ -727,8 +726,10 @@ struct qeth_card_blkt {
727 int inter_packet_jumbo; 726 int inter_packet_jumbo;
728}; 727};
729 728
730 729#define QETH_BROADCAST_WITH_ECHO 0x01
731 730#define QETH_BROADCAST_WITHOUT_ECHO 0x02
731#define QETH_LAYER2_MAC_READ 0x01
732#define QETH_LAYER2_MAC_REGISTERED 0x02
732struct qeth_card_info { 733struct qeth_card_info {
733 unsigned short unit_addr2; 734 unsigned short unit_addr2;
734 unsigned short cula; 735 unsigned short cula;
@@ -736,7 +737,7 @@ struct qeth_card_info {
736 __u16 func_level; 737 __u16 func_level;
737 char mcl_level[QETH_MCL_LENGTH + 1]; 738 char mcl_level[QETH_MCL_LENGTH + 1];
738 int guestlan; 739 int guestlan;
739 int layer2_mac_registered; 740 int mac_bits;
740 int portname_required; 741 int portname_required;
741 int portno; 742 int portno;
742 char portname[9]; 743 char portname[9];
@@ -749,6 +750,7 @@ struct qeth_card_info {
749 int unique_id; 750 int unique_id;
750 struct qeth_card_blkt blkt; 751 struct qeth_card_blkt blkt;
751 __u32 csum_mask; 752 __u32 csum_mask;
753 enum qeth_ipa_promisc_modes promisc_mode;
752}; 754};
753 755
754struct qeth_card_options { 756struct qeth_card_options {
@@ -775,6 +777,7 @@ struct qeth_card_options {
775enum qeth_threads { 777enum qeth_threads {
776 QETH_SET_IP_THREAD = 1, 778 QETH_SET_IP_THREAD = 1,
777 QETH_RECOVER_THREAD = 2, 779 QETH_RECOVER_THREAD = 2,
780 QETH_SET_PROMISC_MODE_THREAD = 4,
778}; 781};
779 782
780struct qeth_osn_info { 783struct qeth_osn_info {
@@ -1074,6 +1077,26 @@ qeth_get_qdio_q_format(struct qeth_card *card)
1074 } 1077 }
1075} 1078}
1076 1079
1080static inline int
1081qeth_isdigit(char * buf)
1082{
1083 while (*buf) {
1084 if (!isdigit(*buf++))
1085 return 0;
1086 }
1087 return 1;
1088}
1089
1090static inline int
1091qeth_isxdigit(char * buf)
1092{
1093 while (*buf) {
1094 if (!isxdigit(*buf++))
1095 return 0;
1096 }
1097 return 1;
1098}
1099
1077static inline void 1100static inline void
1078qeth_ipaddr4_to_string(const __u8 *addr, char *buf) 1101qeth_ipaddr4_to_string(const __u8 *addr, char *buf)
1079{ 1102{
@@ -1090,18 +1113,27 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr)
1090 int i; 1113 int i;
1091 1114
1092 start = buf; 1115 start = buf;
1093 for (i = 0; i < 3; i++) { 1116 for (i = 0; i < 4; i++) {
1094 if (!(end = strchr(start, '.'))) 1117 if (i == 3) {
1118 end = strchr(start,0xa);
1119 if (end)
1120 len = end - start;
1121 else
1122 len = strlen(start);
1123 }
1124 else {
1125 end = strchr(start, '.');
1126 len = end - start;
1127 }
1128 if ((len <= 0) || (len > 3))
1095 return -EINVAL; 1129 return -EINVAL;
1096 len = end - start;
1097 memset(abuf, 0, 4); 1130 memset(abuf, 0, 4);
1098 strncpy(abuf, start, len); 1131 strncpy(abuf, start, len);
1132 if (!qeth_isdigit(abuf))
1133 return -EINVAL;
1099 addr[i] = simple_strtoul(abuf, &tmp, 10); 1134 addr[i] = simple_strtoul(abuf, &tmp, 10);
1100 start = end + 1; 1135 start = end + 1;
1101 } 1136 }
1102 memset(abuf, 0, 4);
1103 strcpy(abuf, start);
1104 addr[3] = simple_strtoul(abuf, &tmp, 10);
1105 return 0; 1137 return 0;
1106} 1138}
1107 1139
@@ -1128,18 +1160,27 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
1128 1160
1129 tmp_addr = (u16 *)addr; 1161 tmp_addr = (u16 *)addr;
1130 start = buf; 1162 start = buf;
1131 for (i = 0; i < 7; i++) { 1163 for (i = 0; i < 8; i++) {
1132 if (!(end = strchr(start, ':'))) 1164 if (i == 7) {
1165 end = strchr(start,0xa);
1166 if (end)
1167 len = end - start;
1168 else
1169 len = strlen(start);
1170 }
1171 else {
1172 end = strchr(start, ':');
1173 len = end - start;
1174 }
1175 if ((len <= 0) || (len > 4))
1133 return -EINVAL; 1176 return -EINVAL;
1134 len = end - start;
1135 memset(abuf, 0, 5); 1177 memset(abuf, 0, 5);
1136 strncpy(abuf, start, len); 1178 strncpy(abuf, start, len);
1179 if (!qeth_isxdigit(abuf))
1180 return -EINVAL;
1137 tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); 1181 tmp_addr[i] = simple_strtoul(abuf, &tmp, 16);
1138 start = end + 1; 1182 start = end + 1;
1139 } 1183 }
1140 memset(abuf, 0, 5);
1141 strcpy(abuf, start);
1142 tmp_addr[7] = simple_strtoul(abuf, &tmp, 16);
1143 return 0; 1184 return 0;
1144} 1185}
1145 1186