2 * collectd - src/netcmd.c
3 * Copyright (C) 2007-2012 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
30 #include "configfile.h"
32 #include "utils_cmd_flush.h"
33 #include "utils_cmd_getval.h"
34 #include "utils_cmd_listval.h"
35 #include "utils_cmd_putval.h"
36 #include "utils_cmd_putnotif.h"
38 /* Folks without pthread will need to disable this plugin. */
41 #include <sys/socket.h>
49 #include <gnutls/gnutls.h>
51 #define NC_DEFAULT_SERVICE "25826"
52 #define NC_TLS_DH_BITS 1024
55 * Private data structures
68 _Bool tls_verify_peer;
70 gnutls_certificate_credentials_t tls_credentials;
71 gnutls_dh_params_t tls_dh_params;
72 gnutls_priority_t tls_priority;
75 typedef struct nc_peer_s nc_peer_t;
78 # define NC_READ_BUFFER_SIZE PAGESIZE
79 #elif defined(PAGE_SIZE)
80 # define NC_READ_BUFFER_SIZE PAGE_SIZE
82 # define NC_READ_BUFFER_SIZE 4096
85 struct nc_connection_s
90 size_t read_buffer_fill;
96 gnutls_session_t tls_session;
97 _Bool have_tls_session;
99 typedef struct nc_connection_s nc_connection_t;
105 /* socket configuration */
106 static nc_peer_t *peers = NULL;
107 static size_t peers_num;
109 static struct pollfd *pollfd = NULL;
110 static size_t pollfd_num;
112 static int listen_thread_loop = 0;
113 static int listen_thread_running = 0;
114 static pthread_t listen_thread;
119 static nc_peer_t *nc_fd_to_peer (int fd) /* {{{ */
123 for (i = 0; i < peers_num; i++)
127 for (j = 0; j < peers[i].fds_num; j++)
128 if (peers[i].fds[j] == fd)
133 } /* }}} nc_peer_t *nc_fd_to_peer */
135 static void nc_free_peer (nc_peer_t *p)
144 for (i = 0; i < p->fds_num; i++)
152 sfree (p->tls_cert_file);
153 sfree (p->tls_key_file);
154 sfree (p->tls_ca_file);
155 sfree (p->tls_crl_file);
157 /* TODO(octo): Clean up TLS stuff. */
158 } /* }}} void nc_free_peer */
160 static int nc_register_fd (nc_peer_t *peer, int fd) /* {{{ */
162 struct pollfd *poll_ptr;
165 poll_ptr = realloc (pollfd, (pollfd_num + 1) * sizeof (*pollfd));
166 if (poll_ptr == NULL)
168 ERROR ("netcmd plugin: realloc failed.");
173 memset (&pollfd[pollfd_num], 0, sizeof (pollfd[pollfd_num]));
174 pollfd[pollfd_num].fd = fd;
175 pollfd[pollfd_num].events = POLLIN | POLLPRI;
176 pollfd[pollfd_num].revents = 0;
182 fd_ptr = realloc (peer->fds, (peer->fds_num + 1) * sizeof (*peer->fds));
185 ERROR ("netcmd plugin: realloc failed.");
189 peer->fds[peer->fds_num] = fd;
193 } /* }}} int nc_register_fd */
195 static int nc_tls_init (nc_peer_t *peer) /* {{{ */
202 if ((peer->tls_cert_file == NULL)
203 || (peer->tls_key_file == NULL))
205 DEBUG ("netcmd plugin: Not setting up TLS environment for peer.");
209 DEBUG ("netcmd plugin: Setting up TLS environment for peer.");
211 /* Initialize the structure holding our certificate information. */
212 status = gnutls_certificate_allocate_credentials (&peer->tls_credentials);
213 if (status != GNUTLS_E_SUCCESS)
215 ERROR ("netcmd plugin: gnutls_certificate_allocate_credentials failed: %s",
216 gnutls_strerror (status));
220 /* Set up the configured certificates. */
221 if (peer->tls_ca_file != NULL)
223 status = gnutls_certificate_set_x509_trust_file (peer->tls_credentials,
224 peer->tls_ca_file, GNUTLS_X509_FMT_PEM);
227 ERROR ("netcmd plugin: gnutls_certificate_set_x509_trust_file (%s) "
229 peer->tls_ca_file, gnutls_strerror (status));
234 DEBUG ("netcmd plugin: Successfully loaded %i CA(s).", status);
238 if (peer->tls_crl_file != NULL)
240 status = gnutls_certificate_set_x509_crl_file (peer->tls_credentials,
241 peer->tls_crl_file, GNUTLS_X509_FMT_PEM);
244 ERROR ("netcmd plugin: gnutls_certificate_set_x509_crl_file (%s) "
246 peer->tls_crl_file, gnutls_strerror (status));
251 DEBUG ("netcmd plugin: Successfully loaded %i CRL(s).", status);
255 status = gnutls_certificate_set_x509_key_file (peer->tls_credentials,
256 peer->tls_cert_file, peer->tls_key_file, GNUTLS_X509_FMT_PEM);
257 if (status != GNUTLS_E_SUCCESS)
259 ERROR ("netcmd plugin: gnutls_certificate_set_x509_key_file failed: %s",
260 gnutls_strerror (status));
264 /* Initialize Diffie-Hellman parameters. */
265 gnutls_dh_params_init (&peer->tls_dh_params);
266 gnutls_dh_params_generate2 (peer->tls_dh_params, NC_TLS_DH_BITS);
267 gnutls_certificate_set_dh_params (peer->tls_credentials,
268 peer->tls_dh_params);
270 /* Initialize a "priority cache". This will tell GNUTLS which algorithms to
271 * use and which to avoid. We use the "NORMAL" method for now. */
272 gnutls_priority_init (&peer->tls_priority,
273 /* priority = */ "NORMAL", /* errpos = */ NULL);
276 } /* }}} int nc_tls_init */
278 static gnutls_session_t nc_tls_get_session (nc_peer_t *peer) /* {{{ */
280 gnutls_session_t session;
283 if (peer->tls_credentials == NULL)
286 DEBUG ("netcmd plugin: nc_tls_get_session (%s)", peer->node);
288 /* Initialize new session. */
289 gnutls_init (&session, GNUTLS_SERVER);
291 /* Set cipher priority and credentials based on the information stored with
293 status = gnutls_priority_set (session, peer->tls_priority);
294 if (status != GNUTLS_E_SUCCESS)
296 ERROR ("netcmd plugin: gnutls_priority_set failed: %s",
297 gnutls_strerror (status));
298 gnutls_deinit (session);
302 status = gnutls_credentials_set (session,
303 GNUTLS_CRD_CERTIFICATE, peer->tls_credentials);
304 if (status != GNUTLS_E_SUCCESS)
306 ERROR ("netcmd plugin: gnutls_credentials_set failed: %s",
307 gnutls_strerror (status));
308 gnutls_deinit (session);
312 /* Request the client certificate. If TLSVerifyPeer is set to true,
313 * *require* a client certificate. */
314 gnutls_certificate_server_set_request (session,
315 peer->tls_verify_peer ? GNUTLS_CERT_REQUIRE : GNUTLS_CERT_REQUEST);
318 } /* }}} gnutls_session_t nc_tls_get_session */
320 static int nc_open_socket (nc_peer_t *peer) /* {{{ */
322 struct addrinfo ai_hints;
323 struct addrinfo *ai_list;
324 struct addrinfo *ai_ptr;
327 const char *node = NULL;
328 const char *service = NULL;
333 service = peer->service;
337 service = NC_DEFAULT_SERVICE;
339 memset (&ai_hints, 0, sizeof (ai_hints));
341 ai_hints.ai_flags |= AI_PASSIVE;
344 ai_hints.ai_flags |= AI_ADDRCONFIG;
346 ai_hints.ai_family = AF_UNSPEC;
347 ai_hints.ai_socktype = SOCK_STREAM;
352 service = NC_DEFAULT_SERVICE;
354 status = getaddrinfo (node, service, &ai_hints, &ai_list);
357 ERROR ("netcmd plugin: getaddrinfo failed: %s",
358 gai_strerror (status));
362 for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
367 fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype,
368 ai_ptr->ai_protocol);
371 ERROR ("netcmd plugin: socket(2) failed: %s",
372 sstrerror (errno, errbuf, sizeof (errbuf)));
376 status = bind (fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
380 ERROR ("netcmd plugin: bind(2) failed: %s",
381 sstrerror (errno, errbuf, sizeof (errbuf)));
385 status = listen (fd, /* backlog = */ 8);
389 ERROR ("netcmd plugin: listen(2) failed: %s",
390 sstrerror (errno, errbuf, sizeof (errbuf)));
394 status = nc_register_fd (peer, fd);
400 } /* for (ai_next) */
402 freeaddrinfo (ai_list);
404 return (nc_tls_init (peer));
405 } /* }}} int nc_open_socket */
407 static void nc_connection_close (nc_connection_t *conn) /* {{{ */
418 if (conn->fh_in != NULL)
420 fclose (conn->fh_in);
424 if (conn->fh_out != NULL)
426 fclose (conn->fh_out);
430 if (conn->have_tls_session)
432 gnutls_deinit (conn->tls_session);
433 conn->have_tls_session = 0;
437 } /* }}} void nc_connection_close */
439 static int nc_connection_init (nc_connection_t *conn) /* {{{ */
444 DEBUG ("netcmd plugin: nc_connection_init();");
446 if (conn->have_tls_session)
451 conn->read_buffer = malloc (NC_READ_BUFFER_SIZE);
452 if (conn->read_buffer == NULL)
454 memset (conn->read_buffer, 0, NC_READ_BUFFER_SIZE);
456 /* Make (relatively) sure that 'fd' and 'void*' have the same size to make
458 fd = (intptr_t) conn->fd;
459 gnutls_transport_set_ptr (conn->tls_session,
460 (gnutls_transport_ptr_t) fd);
464 status = gnutls_handshake (conn->tls_session);
465 if (status == GNUTLS_E_SUCCESS)
467 else if ((status == GNUTLS_E_AGAIN) || (status == GNUTLS_E_INTERRUPTED))
471 ERROR ("netcmd plugin: gnutls_handshake failed: %s",
472 gnutls_strerror (status));
480 /* Duplicate the file descriptor. We need two file descriptors, because we
481 * create two FILE* objects. If they pointed to the same FD and we called
482 * fclose() on each, that would call close() twice on the same FD. If
483 * another file is opened in between those two calls, it could get assigned
484 * that FD and weird stuff would happen. */
485 fd_copy = dup (conn->fd);
488 ERROR ("netcmd plugin: dup(2) failed: %s",
489 sstrerror (errno, errbuf, sizeof (errbuf)));
493 conn->fh_in = fdopen (conn->fd, "r");
494 if (conn->fh_in == NULL)
496 ERROR ("netcmd plugin: fdopen failed: %s",
497 sstrerror (errno, errbuf, sizeof (errbuf)));
500 /* Prevent other code from using the FD directly. */
503 conn->fh_out = fdopen (fd_copy, "w");
504 /* Prevent nc_connection_close from calling close(2) on this fd. */
505 if (conn->fh_out == NULL)
507 ERROR ("netcmd plugin: fdopen failed: %s",
508 sstrerror (errno, errbuf, sizeof (errbuf)));
512 /* change output buffer to line buffered mode */
513 if (setvbuf (conn->fh_out, NULL, _IOLBF, 0) != 0)
515 ERROR ("netcmd plugin: setvbuf failed: %s",
516 sstrerror (errno, errbuf, sizeof (errbuf)));
517 nc_connection_close (conn);
522 } /* }}} int nc_connection_init */
524 static char *nc_connection_gets (nc_connection_t *conn, /* {{{ */
525 char *buffer, size_t buffer_size)
528 char *orig_buffer = buffer;
536 if (!conn->have_tls_session)
537 return (fgets (buffer, (int) buffer_size, conn->fh_in));
539 if ((buffer == NULL) || (buffer_size < 2))
545 /* ensure null termination */
546 memset (buffer, 0, buffer_size);
551 size_t max_copy_bytes;
556 /* If there's no more data in the read buffer, read another chunk from the
558 if (conn->read_buffer_fill < 1)
560 status = gnutls_record_recv (conn->tls_session,
561 conn->read_buffer, NC_READ_BUFFER_SIZE);
562 if (status < 0) /* error */
564 ERROR ("netcmd plugin: Error while reading from TLS stream.");
567 else if (status == 0) /* we reached end of file */
569 if (orig_buffer == buffer) /* nothing has been written to the buffer yet */
570 return (NULL); /* end of file */
572 return (orig_buffer);
576 conn->read_buffer_fill = (size_t) status;
579 assert (conn->read_buffer_fill > 0);
581 /* Determine where the first newline character is in the buffer. We're not
582 * using strcspn(3) here, becaus the buffer is possibly not
583 * null-terminated. */
584 newline_pos = conn->read_buffer_fill;
586 for (i = 0; i < conn->read_buffer_fill; i++)
588 if (conn->read_buffer[i] == '\n')
596 /* Determine how many bytes to copy at most. This is MIN(buffer available,
597 * read buffer size, characters to newline). */
598 max_copy_bytes = buffer_size;
599 if (max_copy_bytes > conn->read_buffer_fill)
600 max_copy_bytes = conn->read_buffer_fill;
601 if (max_copy_bytes > (newline_pos + 1))
602 max_copy_bytes = newline_pos + 1;
603 assert (max_copy_bytes > 0);
605 /* Copy bytes to the output buffer. */
606 memcpy (buffer, conn->read_buffer, max_copy_bytes);
607 buffer += max_copy_bytes;
608 assert (buffer_size >= max_copy_bytes);
609 buffer_size -= max_copy_bytes;
611 /* If there is data left in the read buffer, move it to the front of the
613 if (max_copy_bytes < conn->read_buffer_fill)
615 size_t data_left_size = conn->read_buffer_fill - max_copy_bytes;
616 memmove (conn->read_buffer, conn->read_buffer + max_copy_bytes,
618 conn->read_buffer_fill -= max_copy_bytes;
622 assert (max_copy_bytes == conn->read_buffer_fill);
623 conn->read_buffer_fill = 0;
629 if (buffer_size == 0) /* no more space in the output buffer */
633 return (orig_buffer);
634 } /* }}} char *nc_connection_gets */
636 static void *nc_handle_client (void *arg) /* {{{ */
638 nc_connection_t *conn;
644 DEBUG ("netcmd plugin: nc_handle_client: Reading from fd #%i", conn->fd);
646 status = nc_connection_init (conn);
649 nc_connection_close (conn);
650 pthread_exit ((void *) 1);
656 char buffer_copy[1024];
662 if (nc_connection_gets (conn, buffer, sizeof (buffer)) == NULL)
666 WARNING ("netcmd plugin: failed to read from socket #%i: %s",
667 fileno (conn->fh_in),
668 sstrerror (errno, errbuf, sizeof (errbuf)));
673 len = strlen (buffer);
675 && ((buffer[len - 1] == '\n') || (buffer[len - 1] == '\r')))
676 buffer[--len] = '\0';
681 sstrncpy (buffer_copy, buffer, sizeof (buffer_copy));
683 fields_num = strsplit (buffer_copy, fields,
684 sizeof (fields) / sizeof (fields[0]));
688 nc_connection_close (conn);
692 if (strcasecmp (fields[0], "getval") == 0)
694 handle_getval (conn->fh_out, buffer);
696 else if (strcasecmp (fields[0], "putval") == 0)
698 handle_putval (conn->fh_out, buffer);
700 else if (strcasecmp (fields[0], "listval") == 0)
702 handle_listval (conn->fh_out, buffer);
704 else if (strcasecmp (fields[0], "putnotif") == 0)
706 handle_putnotif (conn->fh_out, buffer);
708 else if (strcasecmp (fields[0], "flush") == 0)
710 handle_flush (conn->fh_out, buffer);
714 if (fprintf (conn->fh_out, "-1 Unknown command: %s\n", fields[0]) < 0)
716 WARNING ("netcmd plugin: failed to write to socket #%i: %s",
717 fileno (conn->fh_out),
718 sstrerror (errno, errbuf, sizeof (errbuf)));
722 } /* while (fgets) */
724 DEBUG ("netcmd plugin: nc_handle_client: Exiting..");
725 nc_connection_close (conn);
727 pthread_exit ((void *) 0);
729 } /* }}} void *nc_handle_client */
731 static void *nc_server_thread (void __attribute__((unused)) *arg) /* {{{ */
735 pthread_attr_t th_attr;
739 for (i = 0; i < peers_num; i++)
740 nc_open_socket (peers + i);
743 nc_open_socket (NULL);
747 ERROR ("netcmd plugin: No sockets could be opened.");
748 pthread_exit ((void *) -1);
751 while (listen_thread_loop != 0)
753 status = poll (pollfd, (nfds_t) pollfd_num, /* timeout = */ -1);
756 if ((errno == EINTR) || (errno == EAGAIN))
759 ERROR ("netcmd plugin: poll(2) failed: %s",
760 sstrerror (errno, errbuf, sizeof (errbuf)));
761 listen_thread_loop = 0;
765 for (i = 0; i < pollfd_num; i++)
768 nc_connection_t *conn;
770 if (pollfd[i].revents == 0)
774 else if ((pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL))
777 WARNING ("netcmd plugin: File descriptor %i failed.",
779 close (pollfd[i].fd);
781 pollfd[i].events = 0;
782 pollfd[i].revents = 0;
785 pollfd[i].revents = 0;
787 peer = nc_fd_to_peer (pollfd[i].fd);
790 ERROR ("netcmd plugin: Unable to find peer structure for file "
791 "descriptor #%i.", pollfd[i].fd);
795 status = accept (pollfd[i].fd,
796 /* sockaddr = */ NULL,
797 /* sockaddr_len = */ NULL);
801 ERROR ("netcmd plugin: accept failed: %s",
802 sstrerror (errno, errbuf, sizeof (errbuf)));
806 conn = malloc (sizeof (*conn));
809 ERROR ("netcmd plugin: malloc failed.");
813 memset (conn, 0, sizeof (*conn));
819 && (peer->tls_cert_file != NULL))
821 DEBUG ("netcmd plugin: Starting TLS session on [%s]:%s",
822 (peer->node != NULL) ? peer->node : "any",
823 (peer->service != NULL) ? peer->service : NC_DEFAULT_SERVICE);
824 conn->tls_session = nc_tls_get_session (peer);
825 conn->have_tls_session = 1;
828 DEBUG ("Spawning child to handle connection on fd %i", conn->fd);
830 pthread_attr_init (&th_attr);
831 pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
833 status = pthread_create (&th, &th_attr, nc_handle_client,
837 WARNING ("netcmd plugin: pthread_create failed: %s",
838 sstrerror (errno, errbuf, sizeof (errbuf)));
839 nc_connection_close (conn);
843 } /* while (listen_thread_loop) */
845 for (i = 0; i < pollfd_num; i++)
847 if (pollfd[i].fd < 0)
850 close (pollfd[i].fd);
852 pollfd[i].events = 0;
853 pollfd[i].revents = 0;
860 } /* }}} void *nc_server_thread */
867 * TLSCertFile "/path/to/cert"
868 * TLSKeyFile "/path/to/key"
869 * TLSCAFile "/path/to/ca"
870 * TLSCRLFile "/path/to/crl"
871 * TLSVerifyPeer yes|no
875 static int nc_config_peer (const oconfig_item_t *ci) /* {{{ */
881 p = realloc (peers, sizeof (*peers) * (peers_num + 1));
884 ERROR ("netcmd plugin: realloc failed.");
888 p = peers + peers_num;
889 memset (p, 0, sizeof (*p));
892 p->tls_cert_file = NULL;
893 p->tls_key_file = NULL;
894 p->tls_ca_file = NULL;
895 p->tls_crl_file = NULL;
896 p->tls_verify_peer = 0;
898 for (i = 0; i < ci->children_num; i++)
900 oconfig_item_t *child = ci->children + i;
902 if (strcasecmp ("Address", child->key) == 0)
903 cf_util_get_string (child, &p->node);
904 else if (strcasecmp ("Port", child->key) == 0)
905 cf_util_get_string (child, &p->service);
906 else if (strcasecmp ("TLSCertFile", child->key) == 0)
907 cf_util_get_string (child, &p->tls_cert_file);
908 else if (strcasecmp ("TLSKeyFile", child->key) == 0)
909 cf_util_get_string (child, &p->tls_key_file);
910 else if (strcasecmp ("TLSCAFile", child->key) == 0)
911 cf_util_get_string (child, &p->tls_ca_file);
912 else if (strcasecmp ("TLSCRLFile", child->key) == 0)
913 cf_util_get_string (child, &p->tls_crl_file);
914 else if (strcasecmp ("TLSVerifyPeer", child->key) == 0)
915 cf_util_get_boolean (child, &p->tls_verify_peer);
917 WARNING ("netcmd plugin: The option \"%s\" is not recognized within "
918 "a \"%s\" block.", child->key, ci->key);
923 if (p->tls_verify_peer
924 && ((p->tls_cert_file == NULL)
925 || (p->tls_key_file == NULL)
926 || (p->tls_ca_file == NULL)))
928 ERROR ("netcmd plugin: You have requested to verify peers (using the "
929 "\"TLSVerifyPeer\" option), but the TLS setup is incomplete. "
930 "The \"TLSCertFile\", \"TLSKeyFile\" and \"TLSCAFile\" are "
931 "required for this to work. This \"Listen\" block will be disabled.");
941 DEBUG ("netcmd plugin: node = \"%s\"; service = \"%s\";", p->node, p->service);
946 } /* }}} int nc_config_peer */
948 static int nc_config (oconfig_item_t *ci) /* {{{ */
952 for (i = 0; i < ci->children_num; i++)
954 oconfig_item_t *child = ci->children + i;
956 if (strcasecmp ("Listen", child->key) == 0)
957 nc_config_peer (child);
959 WARNING ("netcmd plugin: The option \"%s\" is not recognized.",
964 } /* }}} int nc_config */
966 static int nc_init (void) /* {{{ */
968 static int have_init = 0;
972 /* Initialize only once. */
977 gnutls_global_init ();
979 listen_thread_loop = 1;
981 status = pthread_create (&listen_thread, NULL, nc_server_thread, NULL);
985 listen_thread_loop = 0;
986 listen_thread_running = 0;
987 ERROR ("netcmd plugin: pthread_create failed: %s",
988 sstrerror (errno, errbuf, sizeof (errbuf)));
992 listen_thread_running = 1;
994 } /* }}} int nc_init */
996 static int nc_shutdown (void) /* {{{ */
998 listen_thread_loop = 0;
1000 if (listen_thread != (pthread_t) 0)
1004 pthread_kill (listen_thread, SIGTERM);
1005 pthread_join (listen_thread, &ret);
1006 listen_thread = (pthread_t) 0;
1009 plugin_unregister_init ("netcmd");
1010 plugin_unregister_shutdown ("netcmd");
1013 } /* }}} int nc_shutdown */
1015 void module_register (void)
1017 plugin_register_complex_config ("netcmd", nc_config);
1018 plugin_register_init ("netcmd", nc_init);
1019 plugin_register_shutdown ("netcmd", nc_shutdown);
1020 } /* void module_register (void) */
1022 /* vim: set sw=2 sts=2 tw=78 et fdm=marker : */