version 1.1.1.2, 2013/07/22 08:44:29
|
version 1.1.1.3, 2016/11/01 09:56:12
|
Line 3
|
Line 3
|
* nat.c |
* nat.c |
* |
* |
* Written by Alexander Motin <mav@FreeBSD.org> |
* Written by Alexander Motin <mav@FreeBSD.org> |
|
* Rewritten by Dmitry Luhtionov <dmitryluhtionov@gmail.com> |
*/ |
*/ |
|
|
#include "ppp.h" |
#include "ppp.h" |
Line 411 int
|
Line 412 int
|
NatStat(Context ctx, int ac, char *av[], void *arg) |
NatStat(Context ctx, int ac, char *av[], void *arg) |
{ |
{ |
NatState const nat = &ctx->bund->iface.nat; |
NatState const nat = &ctx->bund->iface.nat; |
#ifdef NGM_NAT_LIBALIAS_INFO | #ifdef NG_NAT_LIBALIAS_INFO |
IfaceState const iface = &ctx->bund->iface; |
IfaceState const iface = &ctx->bund->iface; |
union { |
union { |
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)]; |
Line 469 NatStat(Context ctx, int ac, char *av[], void *arg)
|
Line 470 NatStat(Context ctx, int ac, char *av[], void *arg)
|
#endif |
#endif |
Printf("NAT options:\r\n"); |
Printf("NAT options:\r\n"); |
OptStat(ctx, &nat->options, gConfList); |
OptStat(ctx, &nat->options, gConfList); |
#ifdef NGM_NAT_LIBALIAS_INFO | #ifdef NG_NAT_LIBALIAS_INFO |
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)); |
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) |