Skip to content

Commit

Permalink
- Support the new modification method of variable with "natptconfig
Browse files Browse the repository at this point in the history
  set" command.
  • Loading branch information
fujisawa committed Jan 13, 2002
1 parent 3c0456d commit 372ee6a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions kame/kame/natptconfig/misc.c
@@ -1,4 +1,4 @@
/* $KAME: misc.c,v 1.21 2002/01/13 12:48:11 fujisawa Exp $ */
/* $KAME: misc.c,v 1.22 2002/01/13 14:22:31 fujisawa Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 and 2001 WIDE Project.
Expand Down Expand Up @@ -221,22 +221,23 @@ setValue(char *name, int val)
{
const char *fn = __FUNCTION__;

int type = 0;
int idx;
struct natpt_msgBox mBox;
struct natptctl_names ctlnames[] = NATPTCTL_NAMES;

for (idx = 0; ctlnames[idx].ctl_name; idx++) {
if (strlen(ctlnames[idx].ctl_name) != strlen(name))
continue;
if (strncasecmp(ctlnames[idx].ctl_name, name, strlen(name)) == 0) {
mBox.flags = idx;
mBox.m_uint = val;
if (soctl(sfd, SIOCSETVALUE, &mBox) < 0)
soctlFailure(fn);
return;
}
}

bzero(&mBox, sizeof(struct natpt_msgBox));

if (strcmp(name, "natpt_debug") == 0) type = NATPT_DEBUG;
else if (strcmp(name, "natpt_dump") == 0) type = NATPT_DUMP;

if (type == 0)
errx(1, "%s(): %s: no such variable\n", fn, name);

mBox.flags = type;
mBox.m_uint = val;

if (soctl(sfd, SIOCSETVALUE, &mBox) < 0)
soctlFailure(fn);
errx(1, "%s(): %s: no such variable\n", fn, name);
}


Expand Down

0 comments on commit 372ee6a

Please sign in to comment.