diff options
author | Corubba Smith <corubba@gmx.de> | 2025-03-29 12:08:55 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2025-03-29 14:43:19 +0100 |
commit | 32233985f24df86c464426c7af5477b012935c46 (patch) | |
tree | 35253e0efe682e42bd94ef7f52fbb759fe0bdd6c /libipulog/ulog_test.c | |
parent | 2f49c9bb6a9e4b7ed26d8e487e372695031aa5f9 (diff) |
ulogd: remove libipulog
The ULOG target was removed from linux kernel with 7200135bc1e6
("netfilter: kill ulog targets") aka v3.17, so remove the userspace
library for it. libnetfilter_log provides the same functionality for
NFLOG, and also a compatibility layer to use NFLOG through the libipulog
api.
Signed-off-by: Corubba Smith <corubba@gmx.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'libipulog/ulog_test.c')
-rw-r--r-- | libipulog/ulog_test.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/libipulog/ulog_test.c b/libipulog/ulog_test.c deleted file mode 100644 index 0665717..0000000 --- a/libipulog/ulog_test.c +++ /dev/null @@ -1,83 +0,0 @@ -/* ulog_test - * - * small testing program for libipulog, part of the netfilter ULOG target - * for the linux 2.4 netfilter subsystem. - * - * (C) 2000 by Harald Welte <laforge@gnumonks.org> - * - * this code is released under the terms of GNU GPL - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <libipulog/libipulog.h> - -#define MYBUFSIZ 2048 - -/* prints some logging about a single packet */ -void handle_packet(ulog_packet_msg_t *pkt) -{ - unsigned char *p; - int i; - - printf("Hook=%u Mark=%lu len=%d ", - pkt->hook, pkt->mark, pkt->data_len); - if (strlen(pkt->prefix)) - printf("Prefix=%s ", pkt->prefix); - - if (pkt->mac_len) - { - printf("mac="); - p = pkt->mac; - for (i = 0; i < pkt->mac_len; i++, p++) - printf("%02x%c", *p, i==pkt->mac_len-1 ? ' ':':'); - } - printf("\n"); - -} - -int main(int argc, char *argv[]) -{ - struct ipulog_handle *h; - unsigned char* buf; - int len; - ulog_packet_msg_t *upkt; - int i; - - if (argc != 4) { - fprintf(stderr, "Usage: %s count group timeout\n", argv[0]); - exit(1); - } - - /* allocate a receive buffer */ - buf = (unsigned char *) malloc(MYBUFSIZ); - - /* create ipulog handle */ - h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2]))); - if (!h) - { - /* if some error occurrs, print it to stderr */ - ipulog_perror(NULL); - exit(1); - } - - alarm(atoi(argv[3])); - - /* loop receiving packets and handling them over to handle_packet */ - for (i = 0; i < atoi(argv[1]); i++) { - len = ipulog_read(h, buf, MYBUFSIZ); - if (len <= 0) { - ipulog_perror("ulog_test: short read"); - exit(1); - } - printf("%d bytes received\n", len); - while (upkt = ipulog_get_packet(h, buf, len)) { - handle_packet(upkt); - } - } - - /* just to give it a cleaner look */ - ipulog_destroy_handle(h); - return 0; -} |