know. This was a no-op, now it's a silent no-op.
* Fixed help string in lctl.
* Fixed lctl set_route date+time parsing bug.
int rc;
kpr_control_interface_t *ci;
+ /* No error if router not preset. Sysadmin is allowed to notify
+ * _everywhere_ when a NID boots or crashes, even if they know
+ * nothing of the peer. */
ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
if (ci == NULL)
- return (-ENODEV);
+ return (0);
rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
int alive, time_t when)
{
unsigned long flags;
- int rc = -ENOENT;
+ int found;
kpr_nal_entry_t *ne = NULL;
kpr_gateway_entry_t *ge = NULL;
struct timeval now;
struct list_head *e;
struct list_head *n;
- CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n",
+ CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n",
byNal ? "NAL" : "userspace",
gateway_nalid, gateway_nid, alive ? "up" : "down");
/* Serialise with lookups (i.e. write lock) */
write_lock_irqsave(&kpr_rwlock, flags);
+ found = 0;
list_for_each_safe (e, n, &kpr_gateways) {
ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
ge->kpge_nid != gateway_nid)
continue;
- rc = 0;
+ found = 1;
break;
}
- if (rc != 0) {
+ if (!found) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
CDEBUG (D_NET, "Gateway not found\n");
- return (rc);
+ return (0);
}
if (when < ge->kpge_timestamp) {
}
}
+ found = 0;
if (!byNal) {
/* userland notified me: notify NAL? */
ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
if (ne != NULL) {
- if (ne->kpne_shutdown ||
- ne->kpne_interface.kprni_notify == NULL) {
- /* no need to notify */
- ne = NULL;
- } else {
+ if (!ne->kpne_shutdown &&
+ ne->kpne_interface.kprni_notify != NULL) {
/* take a ref on this NAL until notifying
* it has completed... */
atomic_inc (&ne->kpne_refcount);
+ found = 1;
}
}
}
write_unlock_irqrestore(&kpr_rwlock, flags);
- if (ne != NULL) {
+ if (found) {
ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
gateway_nid, alive);
/* 'ne' can disappear now... */
return (0);
memset (&tm, 0, sizeof (tm));
- n = sscanf (str, "%d-%d-%d %d:%d:%d",
+ n = sscanf (str, "%d-%d-%d-%d:%d:%d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6)
when = now.tv_sec;
} else if (ptl_parse_time (&when, argv[3]) != 0) {
fprintf(stderr, "Can't parse time %s\n"
- "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+ "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
"or an absolute unix time in seconds\n", argv[3]);
return (-1);
} else if (when > now.tv_sec) {
int rc;
kpr_control_interface_t *ci;
+ /* No error if router not preset. Sysadmin is allowed to notify
+ * _everywhere_ when a NID boots or crashes, even if they know
+ * nothing of the peer. */
ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
if (ci == NULL)
- return (-ENODEV);
+ return (0);
rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
int alive, time_t when)
{
unsigned long flags;
- int rc = -ENOENT;
+ int found;
kpr_nal_entry_t *ne = NULL;
kpr_gateway_entry_t *ge = NULL;
struct timeval now;
struct list_head *e;
struct list_head *n;
- CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n",
+ CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n",
byNal ? "NAL" : "userspace",
gateway_nalid, gateway_nid, alive ? "up" : "down");
/* Serialise with lookups (i.e. write lock) */
write_lock_irqsave(&kpr_rwlock, flags);
+ found = 0;
list_for_each_safe (e, n, &kpr_gateways) {
ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
ge->kpge_nid != gateway_nid)
continue;
- rc = 0;
+ found = 1;
break;
}
- if (rc != 0) {
+ if (!found) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
CDEBUG (D_NET, "Gateway not found\n");
- return (rc);
+ return (0);
}
if (when < ge->kpge_timestamp) {
}
}
+ found = 0;
if (!byNal) {
/* userland notified me: notify NAL? */
ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
if (ne != NULL) {
- if (ne->kpne_shutdown ||
- ne->kpne_interface.kprni_notify == NULL) {
- /* no need to notify */
- ne = NULL;
- } else {
+ if (!ne->kpne_shutdown &&
+ ne->kpne_interface.kprni_notify != NULL) {
/* take a ref on this NAL until notifying
* it has completed... */
atomic_inc (&ne->kpne_refcount);
+ found = 1;
}
}
}
write_unlock_irqrestore(&kpr_rwlock, flags);
- if (ne != NULL) {
+ if (found) {
ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
gateway_nid, alive);
/* 'ne' can disappear now... */
return (0);
memset (&tm, 0, sizeof (tm));
- n = sscanf (str, "%d-%d-%d %d:%d:%d",
+ n = sscanf (str, "%d-%d-%d-%d:%d:%d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6)
when = now.tv_sec;
} else if (ptl_parse_time (&when, argv[3]) != 0) {
fprintf(stderr, "Can't parse time %s\n"
- "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+ "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
"or an absolute unix time in seconds\n", argv[3]);
return (-1);
} else if (when > now.tv_sec) {
"usage: del_route <gateway> [<target>] [<target>]"},
{"set_route", jt_ptl_notify_router, 0,
"enable/disable routes via the given gateway in the portals routing table\n"
- "usage: set_gw <gateway> <up/down> [<time>]"},
+ "usage: set_route <gateway> <up/down> [<time>]"},
{"route_list", jt_ptl_print_routes, 0, "print the portals routing table\n"
"usage: route_list"},
{"recv_mem", jt_ptl_rxmem, 0, "set socket receive buffer size, "