Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13884
b: refs/heads/master
c: bd389b9
h: refs/heads/master
v: v3
  • Loading branch information
Frank Pavlic authored and Jeff Garzik committed Nov 11, 2005
1 parent 8fe0a21 commit 7c17864
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ecc26b87a2b3e8650d3c7fe3fc85a8c73d5560d
refs/heads/master: bd389b9059d8ba4edc563e77f71909d88e566b2d
65 changes: 52 additions & 13 deletions trunk/drivers/s390/net/qeth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -24,7 +25,7 @@

#include "qeth_mpc.h"

#define VERSION_QETH_H "$Revision: 1.142 $"
#define VERSION_QETH_H "$Revision: 1.151 $"

#ifdef CONFIG_QETH_IPV6
#define QETH_VERSION_IPV6 ":IPv6"
Expand Down Expand Up @@ -1074,6 +1075,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)
{
Expand All @@ -1090,18 +1111,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;
}

Expand All @@ -1128,18 +1158,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;
}

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/s390/net/qeth_sys.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* linux/drivers/s390/net/qeth_sys.c ($Revision: 1.55 $)
* linux/drivers/s390/net/qeth_sys.c ($Revision: 1.58 $)
*
* Linux on zSeries OSA Express and HiperSockets support
* This file contains code related to sysfs.
Expand All @@ -20,7 +20,7 @@
#include "qeth_mpc.h"
#include "qeth_fs.h"

const char *VERSION_QETH_SYS_C = "$Revision: 1.55 $";
const char *VERSION_QETH_SYS_C = "$Revision: 1.58 $";

/*****************************************************************************/
/* */
Expand Down Expand Up @@ -1117,7 +1117,7 @@ qeth_parse_ipatoe(const char* buf, enum qeth_prot_versions proto,
start = buf;
/* get address string */
end = strchr(start, '/');
if (!end){
if (!end || (end-start >= 49)){
PRINT_WARN("Invalid format for ipato_addx/delx. "
"Use <ip addr>/<mask bits>\n");
return -EINVAL;
Expand Down

0 comments on commit 7c17864

Please sign in to comment.