|
version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3.2.1, 2023/09/27 11:08:01
|
|
Line 31
|
Line 31
|
| #define UDP_MTU 2048 |
#define UDP_MTU 2048 |
| #define UDP_MRU 2048 |
#define UDP_MRU 2048 |
| |
|
| #define UDP_MAXPARENTIFS 256 | #ifndef SMALL_SYSTEM |
| | #define UDP_MAXPARENTIFS 256 |
| | #else |
| | #define UDP_MAXPARENTIFS 64 |
| | #endif |
| |
|
| struct udpinfo { |
struct udpinfo { |
| struct { |
struct { |
|
Line 85
|
Line 89
|
| |
|
| static void UdpDoClose(Link l); |
static void UdpDoClose(Link l); |
| static void UdpShutdown(Link l); |
static void UdpShutdown(Link l); |
| static int UdpSetCommand(Context ctx, int ac, char *av[], void *arg); | static int UdpSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
| static void UdpNodeUpdate(Link l); |
static void UdpNodeUpdate(Link l); |
| static int UdpListen(Link l); |
static int UdpListen(Link l); |
| static int UdpUnListen(Link l); |
static int UdpUnListen(Link l); |
|
Line 125
|
Line 129
|
| UdpSetCommand, NULL, 2, (void *) SET_ENABLE }, |
UdpSetCommand, NULL, 2, (void *) SET_ENABLE }, |
| { "disable [opt ...]", "Disable option", |
{ "disable [opt ...]", "Disable option", |
| UdpSetCommand, NULL, 2, (void *) SET_DISABLE }, |
UdpSetCommand, NULL, 2, (void *) SET_DISABLE }, |
| { NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
| }; |
}; |
| |
|
| struct UdpIf { |
struct UdpIf { |
|
Line 135 struct UdpIf {
|
Line 139 struct UdpIf {
|
| int csock; /* netgraph Control socket */ |
int csock; /* netgraph Control socket */ |
| EventRef ctrlEvent; /* listen for ctrl messages */ |
EventRef ctrlEvent; /* listen for ctrl messages */ |
| }; |
}; |
| struct UdpIf UdpIfs[UDP_MAXPARENTIFS]; | static struct UdpIf UdpIfs[UDP_MAXPARENTIFS]; |
| |
|
| int UdpListenUpdateSheduled=0; |
|
| struct pppTimer UdpListenUpdateTimer; |
|
| |
|
| /* |
/* |
| * INTERNAL VARIABLES |
* INTERNAL VARIABLES |
| */ |
*/ |
| |
|
| static struct confinfo gConfList[] = { | static const struct confinfo gConfList[] = { |
| { 0, UDP_CONF_RESOLVE_ONCE, "resolve-once" }, |
{ 0, UDP_CONF_RESOLVE_ONCE, "resolve-once" }, |
| { 0, 0, NULL }, |
{ 0, 0, NULL }, |
| }; |
}; |
|
Line 268 UdpOpen(Link l)
|
Line 269 UdpOpen(Link l)
|
| /* Setsockopt socket. */ |
/* Setsockopt socket. */ |
| ksso->level=SOL_SOCKET; |
ksso->level=SOL_SOCKET; |
| ksso->name=SO_REUSEPORT; |
ksso->name=SO_REUSEPORT; |
| ((int *)(ksso->value))[0]=1; | ((int *)(void *)(ksso->value))[0]=1; |
| if (NgSendMsg(csock, path, NGM_KSOCKET_COOKIE, |
if (NgSendMsg(csock, path, NGM_KSOCKET_COOKIE, |
| NGM_KSOCKET_SETOPT, &u, sizeof(u)) < 0) { |
NGM_KSOCKET_SETOPT, &u, sizeof(u)) < 0) { |
| Perror("[%s] can't setsockopt() %s node", |
Perror("[%s] can't setsockopt() %s node", |
|
Line 354 UdpClose(Link l)
|
Line 355 UdpClose(Link l)
|
| static void |
static void |
| UdpShutdown(Link l) |
UdpShutdown(Link l) |
| { |
{ |
| UdpInfo const pi = (UdpInfo) l->info; | UdpInfo const pi = (UdpInfo) l->info; |
| |
|
| if (pi->conf.fqdn_peer_addr) | if (pi->conf.fqdn_peer_addr) |
| Freee(pi->conf.fqdn_peer_addr); | Freee(pi->conf.fqdn_peer_addr); |
| |
|
| UdpDoClose(l); |
UdpDoClose(l); |
| UdpUnListen(l); |
UdpUnListen(l); |
|
Line 412 UdpOrigination(Link l)
|
Line 413 UdpOrigination(Link l)
|
| static int |
static int |
| UdpIsSync(Link l) |
UdpIsSync(Link l) |
| { |
{ |
| |
(void)l; |
| return (1); |
return (1); |
| } |
} |
| |
|
|
Line 650 UdpListen(Link l)
|
Line 652 UdpListen(Link l)
|
| |
|
| /* Make listening UDP socket. */ |
/* Make listening UDP socket. */ |
| if (pi->If->self_addr.family==AF_INET6) { |
if (pi->If->self_addr.family==AF_INET6) { |
| pi->If->csock = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); | pi->If->csock = socket(PF_INET6, socktype(SOCK_DGRAM), IPPROTO_UDP); |
| } else { |
} else { |
| pi->If->csock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | pi->If->csock = socket(PF_INET, socktype(SOCK_DGRAM), IPPROTO_UDP); |
| } |
} |
| (void)fcntl(pi->If->csock, F_SETFD, 1); |
(void)fcntl(pi->If->csock, F_SETFD, 1); |
| |
|
|
Line 730 UdpNodeUpdate(Link l)
|
Line 732 UdpNodeUpdate(Link l)
|
| */ |
*/ |
| |
|
| static int |
static int |
| UdpSetCommand(Context ctx, int ac, char *av[], void *arg) | UdpSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| UdpInfo const pi = (UdpInfo) ctx->lnk->info; |
UdpInfo const pi = (UdpInfo) ctx->lnk->info; |
| char **fqdn_peer_addr = &pi->conf.fqdn_peer_addr; |
char **fqdn_peer_addr = &pi->conf.fqdn_peer_addr; |