|
version 1.1.1.3, 2016/11/01 09:56:12
|
version 1.1.1.4.2.1, 2023/09/27 11:08:01
|
|
Line 34
|
Line 34
|
| UNSET_REDIRECT_PROTO |
UNSET_REDIRECT_PROTO |
| }; |
}; |
| |
|
| static int NatSetCommand(Context ctx, int ac, char *av[], void *arg); | static int NatSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
| |
|
| /* |
/* |
| * GLOBAL VARIABLES |
* GLOBAL VARIABLES |
|
Line 48 static int NatSetCommand(Context ctx, int ac, char *av
|
Line 48 static int NatSetCommand(Context ctx, int ac, char *av
|
| NatSetCommand, AdmitBund, 2, (void *) UNSET_REDIRECT_ADDR }, |
NatSetCommand, AdmitBund, 2, (void *) UNSET_REDIRECT_ADDR }, |
| { "red-proto {proto} {alias-addr} {local_addr} [{remote-addr}]", "Redirect protocol", |
{ "red-proto {proto} {alias-addr} {local_addr} [{remote-addr}]", "Redirect protocol", |
| NatSetCommand, AdmitBund, 2, (void *) UNSET_REDIRECT_PROTO }, |
NatSetCommand, AdmitBund, 2, (void *) UNSET_REDIRECT_PROTO }, |
| { NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
| }; |
}; |
| #endif |
#endif |
| |
|
|
Line 69 static int NatSetCommand(Context ctx, int ac, char *av
|
Line 69 static int NatSetCommand(Context ctx, int ac, char *av
|
| NatSetCommand, AdmitBund, 2, (void *) SET_ENABLE }, |
NatSetCommand, AdmitBund, 2, (void *) SET_ENABLE }, |
| { "disable [opt ...]", "Disable option", |
{ "disable [opt ...]", "Disable option", |
| NatSetCommand, AdmitBund, 2, (void *) SET_DISABLE }, |
NatSetCommand, AdmitBund, 2, (void *) SET_DISABLE }, |
| { NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
| }; |
}; |
| |
|
| /* |
/* |
|
Line 116 NatInit(Bund b)
|
Line 116 NatInit(Bund b)
|
| */ |
*/ |
| |
|
| static int |
static int |
| NatSetCommand(Context ctx, int ac, char *av[], void *arg) | NatSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| NatState const nat = &ctx->bund->iface.nat; |
NatState const nat = &ctx->bund->iface.nat; |
| IfaceState const iface = &ctx->bund->iface; |
IfaceState const iface = &ctx->bund->iface; |
|
Line 186 NatSetCommand(Context ctx, int ac, char *av[], void *a
|
Line 186 NatSetCommand(Context ctx, int ac, char *av[], void *a
|
| if (!inet_aton (av[5], &r_addr)) |
if (!inet_aton (av[5], &r_addr)) |
| Error("bad remote IP address \"%s\"", av[5]); |
Error("bad remote IP address \"%s\"", av[5]); |
| rp = atoi(av[6]); |
rp = atoi(av[6]); |
| if (rp <= 0 || rp > 65535) | if (rp < 0 || rp > 65535) |
| Error("Incorrect remote port number \"%s\"", av[6]); |
Error("Incorrect remote port number \"%s\"", av[6]); |
| } |
} |
| /* OK */ |
/* OK */ |
|
Line 409 NatSetCommand(Context ctx, int ac, char *av[], void *a
|
Line 409 NatSetCommand(Context ctx, int ac, char *av[], void *a
|
| */ |
*/ |
| |
|
| int |
int |
| NatStat(Context ctx, int ac, char *av[], void *arg) | NatStat(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| NatState const nat = &ctx->bund->iface.nat; |
NatState const nat = &ctx->bund->iface.nat; |
| #ifdef NG_NAT_LIBALIAS_INFO |
#ifdef NG_NAT_LIBALIAS_INFO |
|
Line 418 NatStat(Context ctx, int ac, char *av[], void *arg)
|
Line 418 NatStat(Context ctx, int ac, char *av[], void *arg)
|
| u_char buf[sizeof(struct ng_mesg) + sizeof(struct ng_nat_libalias_info)]; |
u_char buf[sizeof(struct ng_mesg) + sizeof(struct ng_nat_libalias_info)]; |
| struct ng_mesg reply; |
struct ng_mesg reply; |
| } u; |
} u; |
| struct ng_nat_libalias_info *const li = \ | struct ng_nat_libalias_info *const nli = \ |
| (struct ng_nat_libalias_info *)(void *)u.reply.data; |
(struct ng_nat_libalias_info *)(void *)u.reply.data; |
| char path[NG_PATHSIZ]; |
char path[NG_PATHSIZ]; |
| #endif |
#endif |
| char buf[48]; |
char buf[48]; |
| int k; |
int k; |
| |
|
| |
(void)ac; |
| |
(void)av; |
| |
(void)arg; |
| |
|
| Printf("NAT configuration:\r\n"); |
Printf("NAT configuration:\r\n"); |
| Printf("\tAlias addresses : %s\r\n", |
Printf("\tAlias addresses : %s\r\n", |
| u_addrtoa(&nat->alias_addr,buf,sizeof(buf))); |
u_addrtoa(&nat->alias_addr,buf,sizeof(buf))); |
|
Line 474 NatStat(Context ctx, int ac, char *av[], void *arg)
|
Line 478 NatStat(Context ctx, int ac, char *av[], void *arg)
|
| if (Enabled(&nat->options, NAT_CONF_LOG) && iface->up && iface->nat_up) { |
if (Enabled(&nat->options, NAT_CONF_LOG) && iface->up && iface->nat_up) { |
| snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, \ |
snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, \ |
| (char *)&ctx->bund->name); |
(char *)&ctx->bund->name); |
| bzero(li, sizeof(struct ng_nat_libalias_info)); | bzero(nli, sizeof(struct ng_nat_libalias_info)); |
| Printf("LibAlias statistic:\r\n"); |
Printf("LibAlias statistic:\r\n"); |
| if (NgFuncSendQuery(path, NGM_NAT_COOKIE, NGM_NAT_LIBALIAS_INFO, |
if (NgFuncSendQuery(path, NGM_NAT_COOKIE, NGM_NAT_LIBALIAS_INFO, |
| NULL, 0, &u.reply, sizeof(u), NULL) < 0) |
NULL, 0, &u.reply, sizeof(u), NULL) < 0) |
| Perror("Can't get LibAlis stats"); | Perror("Can't get LibAlias stats"); |
| Printf("\ticmpLinkCount : %u\r\n", li->icmpLinkCount); | Printf("\ticmpLinkCount : %u\r\n", nli->icmpLinkCount); |
| Printf("\tudpLinkCount : %u\r\n", li->udpLinkCount); | Printf("\tudpLinkCount : %u\r\n", nli->udpLinkCount); |
| Printf("\ttcpLinkCount : %u\r\n", li->tcpLinkCount); | Printf("\ttcpLinkCount : %u\r\n", nli->tcpLinkCount); |
| Printf("\tsctpLinkCount : %u\r\n", li->sctpLinkCount); | Printf("\tsctpLinkCount : %u\r\n", nli->sctpLinkCount); |
| Printf("\tpptpLinkCount : %u\r\n", li->pptpLinkCount); | Printf("\tpptpLinkCount : %u\r\n", nli->pptpLinkCount); |
| Printf("\tprotoLinkCount : %u\r\n", li->protoLinkCount); | Printf("\tprotoLinkCount : %u\r\n", nli->protoLinkCount); |
| Printf("\tfragmentIdLinkCount : %u\r\n", li->fragmentIdLinkCount); | Printf("\tfragmentIdLinkCount : %u\r\n", nli->fragmentIdLinkCount); |
| Printf("\tfragmentPtrLinkCount : %u\r\n", li->fragmentPtrLinkCount); | Printf("\tfragmentPtrLinkCount : %u\r\n", nli->fragmentPtrLinkCount); |
| Printf("\tsockCount : %u\r\n", li->sockCount); | Printf("\tsockCount : %u\r\n", nli->sockCount); |
| } |
} |
| #endif |
#endif |
| return(0); |
return(0); |