ip: in "ip rule add from all table 1", "all" is taken as 0.0.0.0/32,

whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0.
Closes bug 57.
This commit is contained in:
Denis Vlasenko 2009-03-03 14:55:29 +00:00
parent 230997bd61
commit 787a492f23
2 changed files with 22 additions and 18 deletions

View File

@ -117,8 +117,10 @@ int get_addr_1(inet_prefix * addr, char *name, int family)
{
memset(addr, 0, sizeof(*addr));
if (strcmp(name, bb_str_default) == 0 ||
strcmp(name, "all") == 0 || strcmp(name, "any") == 0) {
if (strcmp(name, bb_str_default) == 0
|| strcmp(name, "all") == 0
|| strcmp(name, "any") == 0
) {
addr->family = family;
addr->bytelen = (family == AF_INET6 ? 16 : 4);
addr->bitlen = -1;
@ -146,7 +148,7 @@ int get_addr_1(inet_prefix * addr, char *name, int family)
return 0;
}
int get_prefix_1(inet_prefix * dst, char *arg, int family)
static int get_prefix_1(inet_prefix *dst, char *arg, int family)
{
int err;
unsigned plen;
@ -154,7 +156,10 @@ int get_prefix_1(inet_prefix * dst, char *arg, int family)
memset(dst, 0, sizeof(*dst));
if (strcmp(arg, bb_str_default) == 0 || strcmp(arg, "any") == 0) {
if (strcmp(arg, bb_str_default) == 0
|| strcmp(arg, "all") == 0
|| strcmp(arg, "any") == 0
) {
dst->family = family;
dst->bytelen = 0;
dst->bitlen = 0;
@ -293,7 +298,6 @@ const char *rt_addr_n2a(int af, int UNUSED_PARAM len,
}
}
const char *format_host(int af, int len, void *addr, char *buf, int buflen)
{
#ifdef RESOLVE_HOSTNAMES

View File

@ -60,7 +60,7 @@ struct ipx_addr {
extern uint32_t get_addr32(char *name);
extern int get_addr_1(inet_prefix *dst, char *arg, int family);
extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
/*extern int get_prefix_1(inet_prefix *dst, char *arg, int family);*/
extern int get_addr(inet_prefix *dst, char *arg, int family);
extern int get_prefix(inet_prefix *dst, char *arg, int family);