Lines 1697-1704
Link Here
|
1697 |
IfaceNgIpInit(Bund b, int ready) |
1697 |
IfaceNgIpInit(Bund b, int ready) |
1698 |
{ |
1698 |
{ |
1699 |
struct ngm_connect cn; |
1699 |
struct ngm_connect cn; |
1700 |
char path[NG_PATHLEN + 1]; |
1700 |
char path[NG_PATHSIZ]; |
1701 |
char hook[NG_HOOKLEN + 1]; |
1701 |
char hook[NG_HOOKSIZ]; |
1702 |
|
1702 |
|
1703 |
if (!ready) { |
1703 |
if (!ready) { |
1704 |
/* Dial-on-Demand mode */ |
1704 |
/* Dial-on-Demand mode */ |
Lines 1802-1808
Link Here
|
1802 |
static void |
1802 |
static void |
1803 |
IfaceNgIpShutdown(Bund b) |
1803 |
IfaceNgIpShutdown(Bund b) |
1804 |
{ |
1804 |
{ |
1805 |
char path[NG_PATHLEN + 1]; |
1805 |
char path[NG_PATHSIZ]; |
1806 |
|
1806 |
|
1807 |
#ifdef USE_NG_NAT |
1807 |
#ifdef USE_NG_NAT |
1808 |
if (b->iface.nat_up) |
1808 |
if (b->iface.nat_up) |
Lines 1840-1846
Link Here
|
1840 |
IfaceNgIpv6Init(Bund b, int ready) |
1840 |
IfaceNgIpv6Init(Bund b, int ready) |
1841 |
{ |
1841 |
{ |
1842 |
struct ngm_connect cn; |
1842 |
struct ngm_connect cn; |
1843 |
char path[NG_PATHLEN + 1]; |
1843 |
char path[NG_PATHSIZ]; |
1844 |
|
1844 |
|
1845 |
if (!ready) { |
1845 |
if (!ready) { |
1846 |
} else { |
1846 |
} else { |
Lines 1871-1877
Link Here
|
1871 |
static void |
1871 |
static void |
1872 |
IfaceNgIpv6Shutdown(Bund b) |
1872 |
IfaceNgIpv6Shutdown(Bund b) |
1873 |
{ |
1873 |
{ |
1874 |
char path[NG_PATHLEN + 1]; |
1874 |
char path[NG_PATHSIZ]; |
1875 |
|
1875 |
|
1876 |
NgFuncDisconnect(b->csock, b->name, MPD_HOOK_PPP, NG_PPP_HOOK_IPV6); |
1876 |
NgFuncDisconnect(b->csock, b->name, MPD_HOOK_PPP, NG_PPP_HOOK_IPV6); |
1877 |
|
1877 |
|
Lines 1901-1908
Link Here
|
1901 |
b->name, NG_NAT_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
1901 |
b->name, NG_NAT_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
1902 |
return(-1); |
1902 |
return(-1); |
1903 |
} |
1903 |
} |
1904 |
strlcat(path, ".", NG_PATHLEN); |
1904 |
strlcat(path, ".", NG_PATHSIZ - 1); |
1905 |
strlcat(path, hook, NG_PATHLEN); |
1905 |
strlcat(path, hook, NG_PATHSIZ - 1); |
1906 |
snprintf(nm.name, sizeof(nm.name), "mpd%d-%s-nat", gPid, b->name); |
1906 |
snprintf(nm.name, sizeof(nm.name), "mpd%d-%s-nat", gPid, b->name); |
1907 |
if (NgSendMsg(b->csock, path, |
1907 |
if (NgSendMsg(b->csock, path, |
1908 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
1908 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
Lines 1962-1968
Link Here
|
1962 |
IfaceSetupNAT(Bund b) |
1962 |
IfaceSetupNAT(Bund b) |
1963 |
{ |
1963 |
{ |
1964 |
NatState const nat = &b->iface.nat; |
1964 |
NatState const nat = &b->iface.nat; |
1965 |
char path[NG_PATHLEN+1]; |
1965 |
char path[NG_PATHSIZ]; |
1966 |
|
1966 |
|
1967 |
if (u_addrempty(&nat->alias_addr)) { |
1967 |
if (u_addrempty(&nat->alias_addr)) { |
1968 |
snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, b->name); |
1968 |
snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, b->name); |
Lines 1981-1987
Link Here
|
1981 |
static void |
1981 |
static void |
1982 |
IfaceShutdownNAT(Bund b) |
1982 |
IfaceShutdownNAT(Bund b) |
1983 |
{ |
1983 |
{ |
1984 |
char path[NG_PATHLEN+1]; |
1984 |
char path[NG_PATHSIZ]; |
1985 |
|
1985 |
|
1986 |
snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, b->name); |
1986 |
snprintf(path, sizeof(path), "mpd%d-%s-nat:", gPid, b->name); |
1987 |
NgFuncShutdownNode(b->csock, b->name, path); |
1987 |
NgFuncShutdownNode(b->csock, b->name, path); |
Lines 2005-2012
Link Here
|
2005 |
b->name, NG_TEE_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
2005 |
b->name, NG_TEE_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
2006 |
return(-1); |
2006 |
return(-1); |
2007 |
} |
2007 |
} |
2008 |
strlcat(path, ".", NG_PATHLEN); |
2008 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2009 |
strlcat(path, hook, NG_PATHLEN); |
2009 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2010 |
snprintf(nm.name, sizeof(nm.name), "%s-tee", b->iface.ifname); |
2010 |
snprintf(nm.name, sizeof(nm.name), "%s-tee", b->iface.ifname); |
2011 |
if (NgSendMsg(b->csock, path, |
2011 |
if (NgSendMsg(b->csock, path, |
2012 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
2012 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
Lines 2022-2028
Link Here
|
2022 |
static void |
2022 |
static void |
2023 |
IfaceShutdownTee(Bund b) |
2023 |
IfaceShutdownTee(Bund b) |
2024 |
{ |
2024 |
{ |
2025 |
char path[NG_PATHLEN+1]; |
2025 |
char path[NG_PATHSIZ]; |
2026 |
|
2026 |
|
2027 |
snprintf(path, sizeof(path), "%s-tee:", b->iface.ifname); |
2027 |
snprintf(path, sizeof(path), "%s-tee:", b->iface.ifname); |
2028 |
NgFuncShutdownNode(b->csock, b->name, path); |
2028 |
NgFuncShutdownNode(b->csock, b->name, path); |
Lines 2035-2041
Link Here
|
2035 |
struct ngm_mkpeer mp; |
2035 |
struct ngm_mkpeer mp; |
2036 |
struct ngm_name nm; |
2036 |
struct ngm_name nm; |
2037 |
struct ngm_connect cn; |
2037 |
struct ngm_connect cn; |
2038 |
char path1[NG_PATHLEN+1]; |
2038 |
char path1[NG_PATHSIZ]; |
2039 |
struct { |
2039 |
struct { |
2040 |
struct ng_ipacct_mesg m; |
2040 |
struct ng_ipacct_mesg m; |
2041 |
int data; |
2041 |
int data; |
Lines 2052-2059
Link Here
|
2052 |
b->name, NG_TEE_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
2052 |
b->name, NG_TEE_NODE_TYPE, path, mp.ourhook, strerror(errno))); |
2053 |
return(-1); |
2053 |
return(-1); |
2054 |
} |
2054 |
} |
2055 |
strlcat(path, ".", NG_PATHLEN); |
2055 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2056 |
strlcat(path, hook, NG_PATHLEN); |
2056 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2057 |
snprintf(nm.name, sizeof(nm.name), "%s_acct_tee", b->iface.ifname); |
2057 |
snprintf(nm.name, sizeof(nm.name), "%s_acct_tee", b->iface.ifname); |
2058 |
if (NgSendMsg(b->csock, path, |
2058 |
if (NgSendMsg(b->csock, path, |
2059 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
2059 |
NGM_GENERIC_COOKIE, NGM_NAME, &nm, sizeof(nm)) < 0) { |
Lines 2128-2134
Link Here
|
2128 |
static void |
2128 |
static void |
2129 |
IfaceShutdownIpacct(Bund b) |
2129 |
IfaceShutdownIpacct(Bund b) |
2130 |
{ |
2130 |
{ |
2131 |
char path[NG_PATHLEN+1]; |
2131 |
char path[NG_PATHSIZ]; |
2132 |
|
2132 |
|
2133 |
snprintf(path, sizeof(path), "%s_acct_tee:", b->iface.ifname); |
2133 |
snprintf(path, sizeof(path), "%s_acct_tee:", b->iface.ifname); |
2134 |
NgFuncShutdownNode(b->csock, b->name, path); |
2134 |
NgFuncShutdownNode(b->csock, b->name, path); |
Lines 2165-2177
Link Here
|
2165 |
b->name, path, cn.ourhook, cn.path, cn.peerhook, strerror(errno))); |
2165 |
b->name, path, cn.ourhook, cn.path, cn.peerhook, strerror(errno))); |
2166 |
return (-1); |
2166 |
return (-1); |
2167 |
} |
2167 |
} |
2168 |
strlcat(path, ".", NG_PATHLEN); |
2168 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2169 |
strlcat(path, hook, NG_PATHLEN); |
2169 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2170 |
if (out) { |
2170 |
if (out) { |
2171 |
snprintf(hook, NG_HOOKLEN, "%s%d", NG_NETFLOW_HOOK_DATA, |
2171 |
snprintf(hook, NG_HOOKSIZ - 1, "%s%d", NG_NETFLOW_HOOK_DATA, |
2172 |
gNetflowIface + b->id*2 + out); |
2172 |
gNetflowIface + b->id*2 + out); |
2173 |
} else { |
2173 |
} else { |
2174 |
snprintf(hook, NG_HOOKLEN, "%s%d", NG_NETFLOW_HOOK_OUT, |
2174 |
snprintf(hook, NG_HOOKSIZ - 1, "%s%d", NG_NETFLOW_HOOK_OUT, |
2175 |
gNetflowIface + b->id*2 + out); |
2175 |
gNetflowIface + b->id*2 + out); |
2176 |
} |
2176 |
} |
2177 |
return (0); |
2177 |
return (0); |
Lines 2180-2186
Link Here
|
2180 |
static int |
2180 |
static int |
2181 |
IfaceSetupNetflow(Bund b, char out) |
2181 |
IfaceSetupNetflow(Bund b, char out) |
2182 |
{ |
2182 |
{ |
2183 |
char path[NG_PATHLEN + 1]; |
2183 |
char path[NG_PATHSIZ]; |
2184 |
struct ng_netflow_setdlt nf_setdlt; |
2184 |
struct ng_netflow_setdlt nf_setdlt; |
2185 |
struct ng_netflow_setifindex nf_setidx; |
2185 |
struct ng_netflow_setifindex nf_setidx; |
2186 |
|
2186 |
|
Lines 2213-2226
Link Here
|
2213 |
static void |
2213 |
static void |
2214 |
IfaceShutdownNetflow(Bund b, char out) |
2214 |
IfaceShutdownNetflow(Bund b, char out) |
2215 |
{ |
2215 |
{ |
2216 |
char path[NG_PATHLEN+1]; |
2216 |
char path[NG_PATHSIZ]; |
2217 |
char hook[NG_HOOKLEN+1]; |
2217 |
char hook[NG_HOOKSIZ]; |
2218 |
|
2218 |
|
2219 |
snprintf(path, NG_PATHLEN, "%s:", gNetflowNodeName); |
2219 |
snprintf(path, NG_PATHSIZ - 1, "%s:", gNetflowNodeName); |
2220 |
snprintf(hook, NG_HOOKLEN, "%s%d", NG_NETFLOW_HOOK_DATA, |
2220 |
snprintf(hook, NG_HOOKSIZ - 1, "%s%d", NG_NETFLOW_HOOK_DATA, |
2221 |
gNetflowIface + b->id*2 + out); |
2221 |
gNetflowIface + b->id*2 + out); |
2222 |
NgFuncDisconnect(b->csock, b->name, path, hook); |
2222 |
NgFuncDisconnect(b->csock, b->name, path, hook); |
2223 |
snprintf(hook, NG_HOOKLEN, "%s%d", NG_NETFLOW_HOOK_OUT, |
2223 |
snprintf(hook, NG_HOOKSIZ - 1, "%s%d", NG_NETFLOW_HOOK_OUT, |
2224 |
gNetflowIface + b->id*2 + out); |
2224 |
gNetflowIface + b->id*2 + out); |
2225 |
NgFuncDisconnect(b->csock, b->name, path, hook); |
2225 |
NgFuncDisconnect(b->csock, b->name, path, hook); |
2226 |
} |
2226 |
} |
Lines 2251-2259
Link Here
|
2251 |
goto fail; |
2251 |
goto fail; |
2252 |
} |
2252 |
} |
2253 |
|
2253 |
|
2254 |
strlcat(path, ".", NG_PATHLEN); |
2254 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2255 |
strlcat(path, hook, NG_PATHLEN); |
2255 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2256 |
snprintf(hook, NG_HOOKLEN, "out"); |
2256 |
snprintf(hook, NG_HOOKSIZ - 1, "out"); |
2257 |
|
2257 |
|
2258 |
/* Set the new node's name. */ |
2258 |
/* Set the new node's name. */ |
2259 |
snprintf(nm.name, sizeof(nm.name), "mpd%d-%s-mss", gPid, b->name); |
2259 |
snprintf(nm.name, sizeof(nm.name), "mpd%d-%s-mss", gPid, b->name); |
Lines 2276-2283
Link Here
|
2276 |
goto fail; |
2276 |
goto fail; |
2277 |
} |
2277 |
} |
2278 |
|
2278 |
|
2279 |
strlcat(path, ".", NG_PATHLEN); |
2279 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2280 |
strlcat(path, hook, NG_PATHLEN); |
2280 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2281 |
strcpy(hook, "iface"); |
2281 |
strcpy(hook, "iface"); |
2282 |
|
2282 |
|
2283 |
#if NG_NODESIZ>=32 |
2283 |
#if NG_NODESIZ>=32 |
Lines 2329-2335
Link Here
|
2329 |
{ |
2329 |
{ |
2330 |
#ifdef USE_NG_TCPMSS |
2330 |
#ifdef USE_NG_TCPMSS |
2331 |
struct ng_tcpmss_config tcpmsscfg; |
2331 |
struct ng_tcpmss_config tcpmsscfg; |
2332 |
char path[NG_PATHLEN]; |
2332 |
char path[NG_PATHSIZ - 1]; |
2333 |
|
2333 |
|
2334 |
snprintf(path, sizeof(path), "mpd%d-%s-mss:", gPid, b->name); |
2334 |
snprintf(path, sizeof(path), "mpd%d-%s-mss:", gPid, b->name); |
2335 |
|
2335 |
|
Lines 2422-2428
Link Here
|
2422 |
IfaceShutdownMSS(Bund b) |
2422 |
IfaceShutdownMSS(Bund b) |
2423 |
{ |
2423 |
{ |
2424 |
#ifdef USE_NG_TCPMSS |
2424 |
#ifdef USE_NG_TCPMSS |
2425 |
char path[NG_PATHLEN+1]; |
2425 |
char path[NG_PATHSIZ]; |
2426 |
|
2426 |
|
2427 |
snprintf(path, sizeof(path), "mpd%d-%s-mss:", gPid, b->name); |
2427 |
snprintf(path, sizeof(path), "mpd%d-%s-mss:", gPid, b->name); |
2428 |
NgFuncShutdownNode(b->csock, b->name, path); |
2428 |
NgFuncShutdownNode(b->csock, b->name, path); |
Lines 2454-2461
Link Here
|
2454 |
goto fail; |
2454 |
goto fail; |
2455 |
} |
2455 |
} |
2456 |
|
2456 |
|
2457 |
strlcat(path, ".", NG_PATHLEN); |
2457 |
strlcat(path, ".", NG_PATHSIZ - 1); |
2458 |
strlcat(path, hook, NG_PATHLEN); |
2458 |
strlcat(path, hook, NG_PATHSIZ - 1); |
2459 |
strcpy(hook, "iface"); |
2459 |
strcpy(hook, "iface"); |
2460 |
|
2460 |
|
2461 |
#if NG_NODESIZ>=32 |
2461 |
#if NG_NODESIZ>=32 |
Lines 2494-2503
Link Here
|
2494 |
|
2494 |
|
2495 |
struct ngm_connect cn; |
2495 |
struct ngm_connect cn; |
2496 |
|
2496 |
|
2497 |
char path[NG_PATHLEN + 1]; |
2497 |
char path[NG_PATHSIZ]; |
2498 |
char inhook[2][NG_HOOKLEN+1]; |
2498 |
char inhook[2][NG_HOOKSIZ]; |
2499 |
char inhookn[2][NG_HOOKLEN+1]; |
2499 |
char inhookn[2][NG_HOOKSIZ]; |
2500 |
char outhook[NG_HOOKLEN+1]; |
2500 |
char outhook[NG_HOOKSIZ]; |
2501 |
struct acl *l; |
2501 |
struct acl *l; |
2502 |
char str[ACL_LEN]; |
2502 |
char str[ACL_LEN]; |
2503 |
#define ACL_MAX_PARAMS 5 |
2503 |
#define ACL_MAX_PARAMS 5 |
Lines 2636-2642
Link Here
|
2636 |
(strcasecmp(av[p], "rate-limit") == 0)) { |
2636 |
(strcasecmp(av[p], "rate-limit") == 0)) { |
2637 |
struct ngm_mkpeer mp; |
2637 |
struct ngm_mkpeer mp; |
2638 |
struct ng_car_bulkconf car; |
2638 |
struct ng_car_bulkconf car; |
2639 |
char tmppath[NG_PATHLEN + 1]; |
2639 |
char tmppath[NG_PATHSIZ]; |
2640 |
|
2640 |
|
2641 |
union { |
2641 |
union { |
2642 |
u_char buf[NG_BPF_HOOKPROG_SIZE(ACL_MAX_PROGLEN)]; |
2642 |
u_char buf[NG_BPF_HOOKPROG_SIZE(ACL_MAX_PROGLEN)]; |
Lines 2784-2790
Link Here
|
2784 |
static void |
2784 |
static void |
2785 |
IfaceShutdownLimits(Bund b) |
2785 |
IfaceShutdownLimits(Bund b) |
2786 |
{ |
2786 |
{ |
2787 |
char path[NG_PATHLEN + 1]; |
2787 |
char path[NG_PATHSIZ]; |
2788 |
|
2788 |
|
2789 |
if (b->params.acl_limits[0] || b->params.acl_limits[1]) { |
2789 |
if (b->params.acl_limits[0] || b->params.acl_limits[1]) { |
2790 |
snprintf(path, sizeof(path), "mpd%d-%s-lim:", gPid, b->name); |
2790 |
snprintf(path, sizeof(path), "mpd%d-%s-lim:", gPid, b->name); |