struct list_head pending;
char *sep;
int nob;
+ int i;
ptl_text_buf_t *ptb;
INIT_LIST_HEAD(&pending);
/* Split 'str' into separate commands */
for (;;) {
+ /* skip leading whitespace */
+ while (ptl_iswhite(*str))
+ str++;
+
/* scan for separator or comment */
for (sep = str; *sep != 0; sep++)
if (ptl_issep(*sep) || *sep == '#')
return -1;
}
- memcpy(ptb->ptb_text, str, nob);
+ for (i = 0; i < nob; i++)
+ if (ptl_iswhite(str[i]))
+ ptb->ptb_text[i] = ' ';
+ else
+ ptb->ptb_text[i] = str[i];
+
ptb->ptb_text[nob] = 0;
list_add_tail(&ptb->ptb_list, &pending);
while (ptl_iswhite(*sep))
sep++;
if (*sep == 0) {
- if (ntokens < 3)
+ if (ntokens < 2)
goto token_error;
break;
}
if (*sep != 0)
*sep++ = 0;
- if (ntokens == 1) {
- if (!strcmp(token, "route"))
- continue;
- goto token_error;
- }
-
- if (ntokens == 2)
+ if (ntokens == 1)
tmp2 = &nets; /* expanding nets */
else
tmp2 = &gateways; /* expanding gateways */
continue;
}
- if (ntokens == 2) {
+ if (ntokens == 1) {
net = libcfs_str2net(ptb->ptb_text);
if (net == PTL_NIDNET(PTL_NID_ANY))
goto token_error;
LASSERT (ptl_tbnob == 0);
return rc;
}
-
-ptl_err_t
-ptl_read_route_table (char *fname)
-{
- int rc = PTL_FAIL;
-
- /* read chunks into a page buffer
- * ptl_str2tbs_sep(buffer)
- * if last ptb is partial, copy to start of buffer
- * and read next chunk from there
- * then just ptl_parse_route_tbs()
- */
-
- LASSERT (ptl_tbnob == 0);
- return rc;
-}
-
CFS_MODULE_PARM(routes, "s", charp, 0444,
"routes to non-local networks");
-static char *route_table = "";
-CFS_MODULE_PARM(route_table, "s", charp, 0444,
- "file containing routes");
-
int
kpr_forwarding ()
{
rwlock_init(&kpr_state.kpr_rwlock);
spin_lock_init(&kpr_state.kpr_stats_lock);
- if (routes[0] != 0 &&
- route_table[0] != 0) {
- LCONSOLE_ERROR("Please set either 'routes' or "
- "'route_table' but not both\n");
- return -EINVAL;
- }
-
- if (route_table[0] != 0)
- rc = ptl_read_route_table(route_table);
- else
- rc = ptl_parse_routes(routes);
+ rc = ptl_parse_routes(routes);
+ if (rc != PTL_OK)
+ kpr_finalise();
#ifdef __KERNEL__
if (rc == PTL_OK)