1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/lib/nodes/socket.c

785 lines
20 KiB
C

/** Various socket related functions
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC
* @license GNU General Public License (version 3)
*
* VILLASnode
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <errno.h>
#include <villas/nodes/socket.h>
#include <villas/utils.h>
#include <villas/format_type.h>
#include <villas/sample.h>
#include <villas/queue.h>
#include <villas/plugin.h>
#include <villas/compat.h>
#include <villas/super_node.h>
#ifdef WITH_SOCKET_LAYER_ETH
#include <netinet/ether.h>
#endif /* WITH_SOCKET_LAYER_ETH */
#ifdef WITH_NETEM
#include <villas/kernel/if.h>
#include <villas/kernel/nl.h>
#endif /* WITH_NETEM */
/* Forward declartions */
static struct plugin p;
int socket_type_start(struct super_node *sn)
{
#ifdef WITH_NETEM
struct vlist *interfaces = super_node_get_interfaces(sn);
/* Gather list of used network interfaces */
for (size_t i = 0; i < vlist_length(&p.node.instances); i++) {
struct node *n = (struct node *) vlist_at(&p.node.instances, i);
struct socket *s = (struct socket *) n->_vd;
if (s->layer == SOCKET_LAYER_UNIX)
continue;
/* Determine outgoing interface */
struct interface *j = if_get_egress((struct sockaddr *) &s->out.saddr, interfaces);
vlist_push(&j->nodes, n);
}
#endif /* WITH_NETEM */
return 0;
}
char * socket_print(struct node *n)
{
struct socket *s = (struct socket *) n->_vd;
char *layer = NULL, *buf;
switch (s->layer) {
case SOCKET_LAYER_UDP:
layer = "udp";
break;
case SOCKET_LAYER_IP:
layer = "ip";
break;
case SOCKET_LAYER_ETH:
layer = "eth";
break;
case SOCKET_LAYER_UNIX:
layer = "unix";
break;
}
char *local = socket_print_addr((struct sockaddr *) &s->in.saddr);
char *remote = socket_print_addr((struct sockaddr *) &s->out.saddr);
buf = strf("layer=%s, format=%s, in.address=%s, out.address=%s", layer, format_type_name(s->format), local, remote);
if (s->multicast.enabled) {
char group[INET_ADDRSTRLEN];
char interface[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &s->multicast.mreq.imr_multiaddr, group, sizeof(group));
inet_ntop(AF_INET, &s->multicast.mreq.imr_interface, interface, sizeof(interface));
strcatf(&buf, ", in.multicast.enabled=%s", s->multicast.enabled ? "yes" : "no");
strcatf(&buf, ", in.multicast.loop=%s", s->multicast.loop ? "yes" : "no");
strcatf(&buf, ", in.multicast.group=%s", group);
strcatf(&buf, ", in.multicast.interface=%s", s->multicast.mreq.imr_interface.s_addr == INADDR_ANY ? "any" : interface);
strcatf(&buf, ", in.multicast.ttl=%u", s->multicast.ttl);
}
free(local);
free(remote);
return buf;
}
int socket_check(struct node *n)
{
struct socket *s = (struct socket *) n->_vd;
/* Some checks on the addresses */
if (s->layer != SOCKET_LAYER_UNIX) {
if (s->in.saddr.sa.sa_family != s->out.saddr.sa.sa_family)
error("Address families of local and remote must match!");
}
if (s->layer == SOCKET_LAYER_IP) {
if (ntohs(s->in.saddr.sin.sin_port) != ntohs(s->out.saddr.sin.sin_port))
error("IP protocol numbers of local and remote must match!");
}
#ifdef WITH_SOCKET_LAYER_ETH
else if (s->layer == SOCKET_LAYER_ETH) {
if (ntohs(s->in.saddr.sll.sll_protocol) != ntohs(s->out.saddr.sll.sll_protocol))
error("Ethertypes of local and remote must match!");
if (ntohs(s->in.saddr.sll.sll_protocol) <= 0x5DC)
error("Ethertype must be large than %d or it is interpreted as an IEEE802.3 length field!", 0x5DC);
}
#endif /* WITH_SOCKET_LAYER_ETH */
if (s->multicast.enabled) {
if (s->in.saddr.sa.sa_family != AF_INET)
error("Multicast is only supported by IPv4 for node %s", node_name(n));
uint32_t addr = ntohl(s->multicast.mreq.imr_multiaddr.s_addr);
if ((addr >> 28) != 14)
error("Multicast group address of node %s must be within 224.0.0.0/4", node_name(n));
}
return 0;
}
int socket_start(struct node *n)
{
struct socket *s = (struct socket *) n->_vd;
int ret;
/* Initialize IO */
ret = io_init(&s->io, s->format, &n->in.signals, SAMPLE_HAS_ALL & ~SAMPLE_HAS_OFFSET);
if (ret)
return ret;
ret = io_check(&s->io);
if (ret)
return ret;
/* Create socket */
switch (s->layer) {
case SOCKET_LAYER_UDP:
s->sd = socket(s->in.saddr.sa.sa_family, SOCK_DGRAM, IPPROTO_UDP);
break;
case SOCKET_LAYER_IP:
s->sd = socket(s->in.saddr.sa.sa_family, SOCK_RAW, ntohs(s->in.saddr.sin.sin_port));
break;
#ifdef WITH_SOCKET_LAYER_ETH
case SOCKET_LAYER_ETH:
s->sd = socket(s->in.saddr.sa.sa_family, SOCK_DGRAM, s->in.saddr.sll.sll_protocol);
break;
#endif /* WITH_SOCKET_LAYER_ETH */
case SOCKET_LAYER_UNIX:
s->sd = socket(s->in.saddr.sa.sa_family, SOCK_DGRAM, 0);
break;
default:
error("Invalid socket type!");
}
if (s->sd < 0)
serror("Failed to create socket");
/* Delete Unix domain socket if already existing */
if (s->layer == SOCKET_LAYER_UNIX) {
ret = unlink(s->in.saddr.sun.sun_path);
if (ret && errno != ENOENT)
return ret;
}
/* Bind socket for receiving */
socklen_t addrlen = 0;
switch(s->in.saddr.ss.ss_family) {
case AF_INET:
addrlen = sizeof(struct sockaddr_in);
break;
case AF_INET6:
addrlen = sizeof(struct sockaddr_in6);
break;
case AF_UNIX:
addrlen = SUN_LEN(&s->in.saddr.sun);
break;
#ifdef WITH_SOCKET_LAYER_ETH
case AF_PACKET:
addrlen = sizeof(struct sockaddr_ll);
break;
#endif /* WITH_SOCKET_LAYER_ETH */
default:
addrlen = sizeof(s->in.saddr);
}
ret = bind(s->sd, (struct sockaddr *) &s->in.saddr, addrlen);
if (ret < 0)
serror("Failed to bind socket");
if (s->multicast.enabled) {
ret = setsockopt(s->sd, IPPROTO_IP, IP_MULTICAST_LOOP, &s->multicast.loop, sizeof(s->multicast.loop));
if (ret)
serror("Failed to set multicast loop option");
ret = setsockopt(s->sd, IPPROTO_IP, IP_MULTICAST_TTL, &s->multicast.ttl, sizeof(s->multicast.ttl));
if (ret)
serror("Failed to set multicast ttl option");
ret = setsockopt(s->sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &s->multicast.mreq, sizeof(s->multicast.mreq));
if (ret)
serror("Failed to join multicast group");
}
/* Set socket priority, QoS or TOS IP options */
int prio;
switch (s->layer) {
case SOCKET_LAYER_UDP:
case SOCKET_LAYER_IP:
prio = IPTOS_LOWDELAY;
if (setsockopt(s->sd, IPPROTO_IP, IP_TOS, &prio, sizeof(prio)))
serror("Failed to set type of service (QoS)");
else
debug(LOG_SOCKET | 4, "Set QoS/TOS IP option for node %s to %#x", node_name(n), prio);
break;
default:
#ifdef __linux__
prio = SOCKET_PRIO;
if (setsockopt(s->sd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
serror("Failed to set socket priority");
else
debug(LOG_SOCKET | 4, "Set socket priority for node %s to %d", node_name(n), prio);
break;
#else
{ }
#endif /* __linux__ */
}
s->out.buflen = SOCKET_INITIAL_BUFFER_LEN;
s->out.buf = alloc(s->out.buflen);
if (!s->out.buf)
return -1;
s->in.buflen = SOCKET_INITIAL_BUFFER_LEN;
s->in.buf = alloc(s->in.buflen);
if (!s->in.buf)
return -1;
return 0;
}
int socket_reverse(struct node *n)
{
struct socket *s = (struct socket *) n->_vd;
union sockaddr_union tmp;
tmp = s->in.saddr;
s->in.saddr = s->out.saddr;
s->out.saddr = tmp;
return 0;
}
int socket_stop(struct node *n)
{
int ret;
struct socket *s = (struct socket *) n->_vd;
if (s->multicast.enabled) {
ret = setsockopt(s->sd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &s->multicast.mreq, sizeof(s->multicast.mreq));
if (ret)
serror("Failed to leave multicast group");
}
if (s->sd >= 0) {
ret = close(s->sd);
if (ret)
return ret;
}
ret = io_destroy(&s->io);
if (ret)
return ret;
free(s->in.buf);
free(s->out.buf);
return 0;
}
int socket_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release)
{
int ret;
struct socket *s = (struct socket *) n->_vd;
char *ptr;
ssize_t bytes;
size_t rbytes;
union sockaddr_union src;
socklen_t srclen = sizeof(src);
/* Receive next sample */
bytes = recvfrom(s->sd, s->in.buf, s->in.buflen, 0, &src.sa, &srclen);
if (bytes < 0)
serror("Failed recv from node %s", node_name(n));
else if (bytes == 0)
return 0;
ptr = s->in.buf;
/* Strip IP header from packet */
if (s->layer == SOCKET_LAYER_IP) {
struct ip *iphdr = (struct ip *) ptr;
bytes -= iphdr->ip_hl * 4;
ptr += iphdr->ip_hl * 4;
}
/* SOCK_RAW IP sockets to not provide the IP protocol number via recvmsg()
* So we simply set it ourself. */
if (s->layer == SOCKET_LAYER_IP) {
switch (src.sa.sa_family) {
case AF_INET:
src.sin.sin_port = s->out.saddr.sin.sin_port;
break;
case AF_INET6:
src.sin6.sin6_port = s->out.saddr.sin6.sin6_port;
break;
}
}
if (s->verify_source && socket_compare_addr(&src.sa, &s->out.saddr.sa) != 0) {
char *buf = socket_print_addr((struct sockaddr *) &src);
warning("Received packet from unauthorized source: %s", buf);
free(buf);
return 0;
}
ret = io_sscan(&s->io, ptr, bytes, &rbytes, smps, cnt);
if (ret < 0 || bytes != rbytes)
warning("Received invalid packet from node: %s ret=%d, bytes=%zu, rbytes=%zu", node_name(n), ret, bytes, rbytes);
return ret;
}
int socket_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release)
{
struct socket *s = (struct socket *) n->_vd;
int ret;
ssize_t bytes;
size_t wbytes;
retry: ret = io_sprint(&s->io, s->out.buf, s->out.buflen, &wbytes, smps, cnt);
if (ret < 0) {
warning("Failed to format payload: reason=%d", ret);
return ret;
}
if (wbytes == 0) {
warning("Failed to format payload: wbytes=%zu", wbytes);
return -1;
}
if (wbytes > s->out.buflen) {
s->out.buflen = wbytes;
s->out.buf = realloc(s->out.buf, s->out.buflen);
goto retry;
}
/* Send message */
socklen_t addrlen = 0;
switch(s->in.saddr.ss.ss_family) {
case AF_INET:
addrlen = sizeof(struct sockaddr_in);
break;
case AF_INET6:
addrlen = sizeof(struct sockaddr_in6);
break;
case AF_UNIX:
addrlen = SUN_LEN(&s->in.saddr.sun);
break;
#ifdef WITH_SOCKET_LAYER_ETH
case AF_PACKET:
addrlen = sizeof(struct sockaddr_ll);
break;
#endif /* WITH_SOCKET_LAYER_ETH */
default:
addrlen = sizeof(s->in.saddr);
}
retry2: bytes = sendto(s->sd, s->out.buf, wbytes, 0, (struct sockaddr *) &s->out.saddr, addrlen);
if (bytes < 0) {
if ((errno == EPERM) ||
(errno == ENOENT && s->layer == SOCKET_LAYER_UNIX))
warning("Failed send to node %s: %s", node_name(n), strerror(errno));
else if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
warning("socket: send would block");
goto retry2;
}
else
warning("Failed sendto() to node %s", node_name(n));
}
if (bytes != wbytes)
warning("Partial sendto() to node %s", node_name(n));
return cnt;
}
int socket_parse(struct node *n, json_t *cfg)
{
struct socket *s = (struct socket *) n->_vd;
const char *local, *remote;
const char *layer = NULL;
const char *format = "villas.binary";
int ret;
json_t *json_multicast = NULL;
json_error_t err;
/* Default values */
s->layer = SOCKET_LAYER_UDP;
s->verify_source = 0;
ret = json_unpack_ex(cfg, &err, 0, "{ s?: s, s?: s, s: { s: s }, s: { s: s, s?: b, s?: o } }",
"layer", &layer,
"format", &format,
"out",
"address", &remote,
"in",
"address", &local,
"verify_source", &s->verify_source,
"multicast", &json_multicast
);
if (ret)
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
/* Format */
s->format = format_type_lookup(format);
if (!s->format)
error("Invalid format '%s' for node %s", format, node_name(n));
/* IP layer */
if (layer) {
if (!strcmp(layer, "ip"))
s->layer = SOCKET_LAYER_IP;
#ifdef WITH_SOCKET_LAYER_ETH
else if (!strcmp(layer, "eth"))
s->layer = SOCKET_LAYER_ETH;
#endif /* WITH_SOCKET_LAYER_ETH */
else if (!strcmp(layer, "udp"))
s->layer = SOCKET_LAYER_UDP;
else if (!strcmp(layer, "unix") || !strcmp(layer, "local"))
s->layer = SOCKET_LAYER_UNIX;
else
error("Invalid layer '%s' for node %s", layer, node_name(n));
}
ret = socket_parse_address(remote, (struct sockaddr *) &s->out.saddr, s->layer, 0);
if (ret) {
error("Failed to resolve remote address '%s' of node %s: %s",
remote, node_name(n), gai_strerror(ret));
}
ret = socket_parse_address(local, (struct sockaddr *) &s->in.saddr, s->layer, AI_PASSIVE);
if (ret) {
error("Failed to resolve local address '%s' of node %s: %s",
local, node_name(n), gai_strerror(ret));
}
if (json_multicast) {
const char *group, *interface = NULL;
/* Default values */
s->multicast.enabled = true;
s->multicast.mreq.imr_interface.s_addr = INADDR_ANY;
s->multicast.loop = 0;
s->multicast.ttl = 255;
ret = json_unpack_ex(json_multicast, &err, 0, "{ s?: b, s: s, s?: s, s?: b, s?: i }",
"enabled", &s->multicast.enabled,
"group", &group,
"interface", &interface,
"loop", &s->multicast.loop,
"ttl", &s->multicast.ttl
);
if (ret)
jerror(&err, "Failed to parse setting 'multicast' of node %s", node_name(n));
ret = inet_aton(group, &s->multicast.mreq.imr_multiaddr);
if (!ret) {
error("Failed to resolve multicast group address '%s' of node %s",
group, node_name(n));
}
if (interface) {
ret = inet_aton(group, &s->multicast.mreq.imr_interface);
if (!ret) {
error("Failed to resolve multicast interface address '%s' of node %s",
interface, node_name(n));
}
}
}
return 0;
}
char * socket_print_addr(struct sockaddr *saddr)
{
union sockaddr_union *sa = (union sockaddr_union *) saddr;
char *buf = alloc(64);
/* Address */
switch (sa->sa.sa_family) {
case AF_INET6:
inet_ntop(AF_INET6, &sa->sin6.sin6_addr, buf, 64);
break;
case AF_INET:
inet_ntop(AF_INET, &sa->sin.sin_addr, buf, 64);
break;
#ifdef WITH_SOCKET_LAYER_ETH
case AF_PACKET:
strcatf(&buf, "%02x", sa->sll.sll_addr[0]);
for (int i = 1; i < sa->sll.sll_halen; i++)
strcatf(&buf, ":%02x", sa->sll.sll_addr[i]);
break;
#endif /* WITH_SOCKET_LAYER_ETH */
case AF_UNIX:
strcatf(&buf, "%s", sa->sun.sun_path);
break;
default:
error("Unknown address family: '%u'", sa->sa.sa_family);
}
/* Port / Interface */
switch (sa->sa.sa_family) {
case AF_INET6:
case AF_INET:
strcatf(&buf, ":%hu", ntohs(sa->sin.sin_port));
break;
#ifdef WITH_SOCKET_LAYER_ETH
case AF_PACKET: {
struct nl_cache *cache = nl_cache_mngt_require("route/link");
struct rtnl_link *link = rtnl_link_get(cache, sa->sll.sll_ifindex);
if (!link)
error("Failed to get interface for index: %u", sa->sll.sll_ifindex);
strcatf(&buf, "%%%s", rtnl_link_get_name(link));
strcatf(&buf, ":%hu", ntohs(sa->sll.sll_protocol));
break;
}
#endif /* WITH_SOCKET_LAYER_ETH */
}
return buf;
}
int socket_parse_address(const char *addr, struct sockaddr *saddr, enum socket_layer layer, int flags)
{
/** @todo: Add support for IPv6 */
union sockaddr_union *sa = (union sockaddr_union *) saddr;
char *copy = strdup(addr);
int ret;
if (layer == SOCKET_LAYER_UNIX) { /* Format: "/path/to/socket" */
sa->sun.sun_family = AF_UNIX;
if (strlen(addr) > sizeof(sa->sun.sun_path) - 1)
error("Length of unix socket path is too long!");
memcpy(sa->sun.sun_path, addr, strlen(addr) + 1);
ret = 0;
}
#ifdef WITH_SOCKET_LAYER_ETH
else if (layer == SOCKET_LAYER_ETH) { /* Format: "ab:cd:ef:12:34:56%ifname:protocol" */
/* Split string */
char *node = strtok(copy, "%");
char *ifname = strtok(NULL, ":");
char *proto = strtok(NULL, "\0");
/* Parse link layer (MAC) address */
struct ether_addr *mac = ether_aton(node);
if (!mac)
error("Failed to parse MAC address: %s", node);
memcpy(&sa->sll.sll_addr, &mac->ether_addr_octet, ETHER_ADDR_LEN);
/* Get interface index from name */
nl_init();
struct nl_cache *cache = nl_cache_mngt_require("route/link");
struct rtnl_link *link = rtnl_link_get_by_name(cache, ifname);
if (!link)
error("Failed to get network interface: '%s'", ifname);
sa->sll.sll_protocol = htons(proto ? strtol(proto, NULL, 0) : ETH_P_VILLAS);
sa->sll.sll_halen = ETHER_ADDR_LEN;
sa->sll.sll_family = AF_PACKET;
sa->sll.sll_ifindex = rtnl_link_get_ifindex(link);
ret = 0;
}
#endif /* WITH_SOCKET_LAYER_ETH */
else { /* Format: "192.168.0.10:12001" */
struct addrinfo hint = {
.ai_flags = flags,
.ai_family = AF_UNSPEC
};
/* Split string */
char *node = strtok(copy, ":");
char *service = strtok(NULL, "\0");
if (node && !strcmp(node, "*"))
node = NULL;
if (service && !strcmp(service, "*"))
service = NULL;
switch (layer) {
case SOCKET_LAYER_IP:
hint.ai_socktype = SOCK_RAW;
hint.ai_protocol = (service) ? strtol(service, NULL, 0) : IPPROTO_VILLAS;
hint.ai_flags |= AI_NUMERICSERV;
break;
case SOCKET_LAYER_UDP:
hint.ai_socktype = SOCK_DGRAM;
hint.ai_protocol = IPPROTO_UDP;
break;
default:
error("Invalid address type");
}
/* Lookup address */
struct addrinfo *result;
ret = getaddrinfo(node, (layer == SOCKET_LAYER_IP) ? NULL : service, &hint, &result);
if (!ret) {
if (layer == SOCKET_LAYER_IP) {
/* We mis-use the sin_port field to store the IP protocol number on RAW sockets */
struct sockaddr_in *sin = (struct sockaddr_in *) result->ai_addr;
sin->sin_port = htons(result->ai_protocol);
}
memcpy(sa, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
}
}
free(copy);
return ret;
}
int socket_compare_addr(struct sockaddr *x, struct sockaddr *y)
{
#define CMP(a, b) if (a != b) return a < b ? -1 : 1
union sockaddr_union *xu = (void *) x, *yu = (void *) y;
CMP(x->sa_family, y->sa_family);
switch (x->sa_family) {
case AF_UNIX:
return strcmp(xu->sun.sun_path, yu->sun.sun_path);
case AF_INET:
CMP(ntohl(xu->sin.sin_addr.s_addr), ntohl(yu->sin.sin_addr.s_addr));
CMP(ntohs(xu->sin.sin_port), ntohs(yu->sin.sin_port));
return 0;
case AF_INET6:
CMP(ntohs(xu->sin6.sin6_port), ntohs(yu->sin6.sin6_port));
// CMP(xu->sin6.sin6_flowinfo, yu->sin6.sin6_flowinfo);
// CMP(xu->sin6.sin6_scope_id, yu->sin6.sin6_scope_id);
return memcmp(xu->sin6.sin6_addr.s6_addr, yu->sin6.sin6_addr.s6_addr, sizeof(xu->sin6.sin6_addr.s6_addr));
#ifdef WITH_SOCKET_LAYER_ETH
case AF_PACKET:
CMP(ntohs(xu->sll.sll_protocol), ntohs(yu->sll.sll_protocol));
CMP(xu->sll.sll_ifindex, yu->sll.sll_ifindex);
// CMP(xu->sll.sll_pkttype, yu->sll.sll_pkttype);
// CMP(xu->sll.sll_hatype, yu->sll.sll_hatype);
CMP(xu->sll.sll_halen, yu->sll.sll_halen);
return memcmp(xu->sll.sll_addr, yu->sll.sll_addr, xu->sll.sll_halen);
#endif /* WITH_SOCKET_LAYER_ETH */
default:
return -1;
}
#undef CMP
}
int socket_fds(struct node *n, int fds[])
{
struct socket *s = (struct socket *) n->_vd;
fds[0] = s->sd;
return 1;
}
static struct plugin p = {
.name = "socket",
#ifdef WITH_NETEM
.description = "BSD network sockets for Ethernet / IP / UDP (libnl3, netem support)",
#else
.description = "BSD network sockets for Ethernet / IP / UDP",
#endif
.type = PLUGIN_TYPE_NODE,
.node = {
.vectorize = 0,
.size = sizeof(struct socket),
.type.start = socket_type_start,
.reverse = socket_reverse,
.parse = socket_parse,
.print = socket_print,
.check = socket_check,
.start = socket_start,
.stop = socket_stop,
.read = socket_read,
.write = socket_write,
.poll_fds = socket_fds,
.netem_fds = socket_fds
}
};
REGISTER_PLUGIN(&p)
LIST_INIT_STATIC(&p.node.instances)