diff options
Diffstat (limited to 'drivers/s390/net/qeth.h')
-rw-r--r-- | drivers/s390/net/qeth.h | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 38a2441564d..d238c7ed103 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h @@ -8,6 +8,7 @@ #include <linux/trdevice.h> #include <linux/etherdevice.h> #include <linux/if_vlan.h> +#include <linux/ctype.h> #include <net/ipv6.h> #include <linux/in6.h> @@ -24,7 +25,7 @@ #include "qeth_mpc.h" -#define VERSION_QETH_H "$Revision: 1.142 $" +#define VERSION_QETH_H "$Revision: 1.152 $" #ifdef CONFIG_QETH_IPV6 #define QETH_VERSION_IPV6 ":IPv6" @@ -718,8 +719,6 @@ struct qeth_reply { atomic_t refcnt; }; -#define QETH_BROADCAST_WITH_ECHO 1 -#define QETH_BROADCAST_WITHOUT_ECHO 2 struct qeth_card_blkt { int time_total; @@ -727,8 +726,10 @@ struct qeth_card_blkt { int inter_packet_jumbo; }; - - +#define QETH_BROADCAST_WITH_ECHO 0x01 +#define QETH_BROADCAST_WITHOUT_ECHO 0x02 +#define QETH_LAYER2_MAC_READ 0x01 +#define QETH_LAYER2_MAC_REGISTERED 0x02 struct qeth_card_info { unsigned short unit_addr2; unsigned short cula; @@ -736,7 +737,7 @@ struct qeth_card_info { __u16 func_level; char mcl_level[QETH_MCL_LENGTH + 1]; int guestlan; - int layer2_mac_registered; + int mac_bits; int portname_required; int portno; char portname[9]; @@ -749,6 +750,7 @@ struct qeth_card_info { int unique_id; struct qeth_card_blkt blkt; __u32 csum_mask; + enum qeth_ipa_promisc_modes promisc_mode; }; struct qeth_card_options { @@ -775,6 +777,7 @@ struct qeth_card_options { enum qeth_threads { QETH_SET_IP_THREAD = 1, QETH_RECOVER_THREAD = 2, + QETH_SET_PROMISC_MODE_THREAD = 4, }; struct qeth_osn_info { @@ -1074,6 +1077,26 @@ qeth_get_qdio_q_format(struct qeth_card *card) } } +static inline int +qeth_isdigit(char * buf) +{ + while (*buf) { + if (!isdigit(*buf++)) + return 0; + } + return 1; +} + +static inline int +qeth_isxdigit(char * buf) +{ + while (*buf) { + if (!isxdigit(*buf++)) + return 0; + } + return 1; +} + static inline void qeth_ipaddr4_to_string(const __u8 *addr, char *buf) { @@ -1090,18 +1113,27 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) int i; start = buf; - for (i = 0; i < 3; i++) { - if (!(end = strchr(start, '.'))) + for (i = 0; i < 4; i++) { + if (i == 3) { + end = strchr(start,0xa); + if (end) + len = end - start; + else + len = strlen(start); + } + else { + end = strchr(start, '.'); + len = end - start; + } + if ((len <= 0) || (len > 3)) return -EINVAL; - len = end - start; memset(abuf, 0, 4); strncpy(abuf, start, len); + if (!qeth_isdigit(abuf)) + return -EINVAL; addr[i] = simple_strtoul(abuf, &tmp, 10); start = end + 1; } - memset(abuf, 0, 4); - strcpy(abuf, start); - addr[3] = simple_strtoul(abuf, &tmp, 10); return 0; } @@ -1128,18 +1160,27 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) tmp_addr = (u16 *)addr; start = buf; - for (i = 0; i < 7; i++) { - if (!(end = strchr(start, ':'))) + for (i = 0; i < 8; i++) { + if (i == 7) { + end = strchr(start,0xa); + if (end) + len = end - start; + else + len = strlen(start); + } + else { + end = strchr(start, ':'); + len = end - start; + } + if ((len <= 0) || (len > 4)) return -EINVAL; - len = end - start; memset(abuf, 0, 5); strncpy(abuf, start, len); + if (!qeth_isxdigit(abuf)) + return -EINVAL; tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); start = end + 1; } - memset(abuf, 0, 5); - strcpy(abuf, start); - tmp_addr[7] = simple_strtoul(abuf, &tmp, 16); return 0; } |