mirror of https://github.com/schoebel/mars
main: fix hostname prefix matching
This commit is contained in:
parent
e20800c47c
commit
545c5c6001
|
@ -46,6 +46,7 @@ atomic_t mars_global_io_flying = ATOMIC_INIT(0);
|
|||
EXPORT_SYMBOL_GPL(mars_global_io_flying);
|
||||
|
||||
static char id[__NEW_UTS_LEN + 2] = {};
|
||||
static int id_len = 0;
|
||||
|
||||
/* TODO: use MAC addresses (or motherboard IDs etc) for _validation_
|
||||
* of nodenames.
|
||||
|
@ -62,12 +63,17 @@ char *my_id(void)
|
|||
u = utsname();
|
||||
if (u) {
|
||||
strncpy(id, u->nodename, sizeof(id));
|
||||
id_len = strlen(id);
|
||||
}
|
||||
//up_read(&uts_sem);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(my_id);
|
||||
|
||||
int my_id_len(void)
|
||||
{
|
||||
return id_len;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -7101,7 +7101,8 @@ int main_checker(struct mars_dent *parent,
|
|||
if (prefix)
|
||||
*prefix = len;
|
||||
if (test->cl_hostcontext) {
|
||||
if (memcmp(name+len, my_id(), namlen-len)) {
|
||||
if (namlen-len != my_id_len() ||
|
||||
memcmp(name+len, my_id(), namlen-len)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ extern int mars_test_additional_peers;
|
|||
extern void invalidate_user_cache(void);
|
||||
|
||||
extern char *my_id(void);
|
||||
extern int my_id_len(void);
|
||||
extern const char *my_uuid;
|
||||
|
||||
extern void wait_main_round(void);
|
||||
|
|
Loading…
Reference in New Issue