#define DEBUG_SUBSYSTEM S_LNET
#include <libcfs/libcfs.h>
-#include <lnet/lnet.h>
+#include <lnet/nidstr.h>
#ifndef __KERNEL__
#ifdef HAVE_GETHOSTBYNAME
# include <netdb.h>
#endif
#endif
+/* max value for numeric network address */
+#define MAX_NUMERIC_VALUE 0xffffffff
+
#define IPSTRING_LENGTH 16
/* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
int
libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
{
- int a;
- int b;
- int c;
- int d;
- int n = nob; /* XscanfX */
+ unsigned int a;
+ unsigned int b;
+ unsigned int c;
+ unsigned int d;
+ int n = nob; /* XscanfX */
/* numeric IP? */
if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
libcfs_str2net_internal(const char *str, __u32 *net)
{
struct netstrfns *nf = NULL;
- int nob;
- int netnum;
- int i;
+ int nob;
+ unsigned int netnum;
+ int i;
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
struct cfs_lstr src;
struct cfs_lstr res;
int rc;
- ENTRY;
src.ls_str = str;
src.ls_len = len;
rc = cfs_gettok(&src, ' ', &res);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
rc = parse_nidrange(&res, nidlist);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
}
- RETURN(1);
+ return 1;
}
/*
{
struct nidrange *nr;
struct addrrange *ar;
- ENTRY;
list_for_each_entry(nr, nidlist, nr_link) {
if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid)))
if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid)))
continue;
if (nr->nr_all)
- RETURN(1);
+ return 1;
list_for_each_entry(ar, &nr->nr_addrranges, ar_link)
if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid),
&ar->ar_numaddr_ranges))
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
static int
{
int i = 0;
struct nidrange *nr;
- ENTRY;
if (count <= 0)
- RETURN(0);
+ return 0;
list_for_each_entry(nr, nidlist, nr_link) {
if (i != 0)
&nr->nr_addrranges, nr);
}
}
- RETURN(i);
+ return i;
}
/**