diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/pktgen.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 24a19debda1b..10a1ea72010d 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1434,18 +1434,12 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1434 | i += len; | 1434 | i += len; |
1435 | 1435 | ||
1436 | for (*m = 0; *v && m < pkt_dev->dst_mac + 6; v++) { | 1436 | for (*m = 0; *v && m < pkt_dev->dst_mac + 6; v++) { |
1437 | if (*v >= '0' && *v <= '9') { | 1437 | int value; |
1438 | *m *= 16; | 1438 | |
1439 | *m += *v - '0'; | 1439 | value = hex_to_bin(*v); |
1440 | } | 1440 | if (value >= 0) |
1441 | if (*v >= 'A' && *v <= 'F') { | 1441 | *m = *m * 16 + value; |
1442 | *m *= 16; | 1442 | |
1443 | *m += *v - 'A' + 10; | ||
1444 | } | ||
1445 | if (*v >= 'a' && *v <= 'f') { | ||
1446 | *m *= 16; | ||
1447 | *m += *v - 'a' + 10; | ||
1448 | } | ||
1449 | if (*v == ':') { | 1443 | if (*v == ':') { |
1450 | m++; | 1444 | m++; |
1451 | *m = 0; | 1445 | *m = 0; |
@@ -1476,18 +1470,12 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1476 | i += len; | 1470 | i += len; |
1477 | 1471 | ||
1478 | for (*m = 0; *v && m < pkt_dev->src_mac + 6; v++) { | 1472 | for (*m = 0; *v && m < pkt_dev->src_mac + 6; v++) { |
1479 | if (*v >= '0' && *v <= '9') { | 1473 | int value; |
1480 | *m *= 16; | 1474 | |
1481 | *m += *v - '0'; | 1475 | value = hex_to_bin(*v); |
1482 | } | 1476 | if (value >= 0) |
1483 | if (*v >= 'A' && *v <= 'F') { | 1477 | *m = *m * 16 + value; |
1484 | *m *= 16; | 1478 | |
1485 | *m += *v - 'A' + 10; | ||
1486 | } | ||
1487 | if (*v >= 'a' && *v <= 'f') { | ||
1488 | *m *= 16; | ||
1489 | *m += *v - 'a' + 10; | ||
1490 | } | ||
1491 | if (*v == ':') { | 1479 | if (*v == ':') { |
1492 | m++; | 1480 | m++; |
1493 | *m = 0; | 1481 | *m = 0; |