diff options
author | fnm3 <fnm3> | 2002-11-25 08:57:37 +0000 |
---|---|---|
committer | fnm3 <fnm3> | 2002-11-25 08:57:37 +0000 |
commit | d737cead0d53481cf6b97c56c795fe84d8caf35b (patch) | |
tree | b6ebd8a6659d3bc1afe74b216925721c5e8bde8d /userspace | |
parent | c543da7dd64218ffb55b2f1df1a5e3542bd73dd6 (diff) |
Removed useless char ethertype_name[21];
Diffstat (limited to 'userspace')
-rw-r--r-- | userspace/ebtables2/extensions/ebt_ip.c | 13 | ||||
-rw-r--r-- | userspace/ebtables2/extensions/ebt_vlan.c | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/userspace/ebtables2/extensions/ebt_ip.c b/userspace/ebtables2/extensions/ebt_ip.c index 7a054ce..9ad272b 100644 --- a/userspace/ebtables2/extensions/ebt_ip.c +++ b/userspace/ebtables2/extensions/ebt_ip.c @@ -57,6 +57,8 @@ static struct option opts[] = { 0 } }; +struct protoent *p_ent; + // put the ip string into 4 bytes static int undot_ip(char *ip, unsigned char *ip2) { @@ -313,9 +315,14 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, ipinfo->invflags |= EBT_IP_PROTO; if (optind > argc) print_error("Missing IP protocol argument"); - i = strtol(argv[optind - 1], &end, 10); - if (i < 0 || i > 255 || *end != '\0') - print_error("Problem with specified IP protocol"); + (unsigned char) i = strtoul(argv[optind - 1], &end, 10); + if ((i > 0xFF) || (*end != '\0')) { + p_ent = getprotobyname(argv[optind - 1]); + if (p_ent == NULL) + print_error("Unknown Internet protocol %s ", + argv[optind - 1]); + i = p_ent->p_proto; + } ipinfo->protocol = i; ipinfo->bitmask |= EBT_IP_PROTO; break; diff --git a/userspace/ebtables2/extensions/ebt_vlan.c b/userspace/ebtables2/extensions/ebt_vlan.c index 2c3fa13..84722ea 100644 --- a/userspace/ebtables2/extensions/ebt_vlan.c +++ b/userspace/ebtables2/extensions/ebt_vlan.c @@ -231,7 +231,6 @@ print(const struct ebt_u_entry *entry, const struct ebt_entry_match *match) struct ebt_vlan_info *vlaninfo = (struct ebt_vlan_info *) match->data; - char ethertype_name[21]; /* * Print VLAN ID if they are specified */ |