|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* gcc -O2 -Wall -shared -fPIC -o libipt_MEDIAPROXY.so libipt_MEDIAPROXY-1.4.c */
|
|
|
|
|
/* gcc -O2 -Wall -shared -fPIC -o libxt_MEDIAPROXY.so libxt_MEDIAPROXY.c */
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
@ -7,8 +7,9 @@
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#include <xtables.h>
|
|
|
|
|
#include <linux/netfilter_ipv4/ip_tables.h>
|
|
|
|
|
#include "../kernel-module/ipt_MEDIAPROXY.h"
|
|
|
|
|
#include <linux/netfilter.h>
|
|
|
|
|
#include <linux/netfilter/x_tables.h>
|
|
|
|
|
#include "../kernel-module/xt_MEDIAPROXY.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void help(void) {
|
|
|
|
|
@ -26,7 +27,7 @@ static int parse(int c,
|
|
|
|
|
const void *entry,
|
|
|
|
|
struct xt_entry_target **target) {
|
|
|
|
|
|
|
|
|
|
struct ipt_mediaproxy_info *info = (void *) (*target)->data;
|
|
|
|
|
struct xt_mediaproxy_info *info = (void *) (*target)->data;
|
|
|
|
|
|
|
|
|
|
if (c == '1') {
|
|
|
|
|
info->id = atoi(optarg);
|
|
|
|
|
@ -45,13 +46,13 @@ static void final_check(unsigned int flags) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void print(const void *ip, const struct xt_entry_target *target, int numeric) {
|
|
|
|
|
struct ipt_mediaproxy_info *info = (void *) target->data;
|
|
|
|
|
struct xt_mediaproxy_info *info = (void *) target->data;
|
|
|
|
|
|
|
|
|
|
printf("id %u", info->id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void save(const void *ip, const struct xt_entry_target *target) {
|
|
|
|
|
struct ipt_mediaproxy_info *info = (void *) target->data;
|
|
|
|
|
struct xt_mediaproxy_info *info = (void *) target->data;
|
|
|
|
|
|
|
|
|
|
printf("--id %u", info->id);
|
|
|
|
|
}
|
|
|
|
|
@ -62,12 +63,26 @@ static struct option opts[] = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct xtables_target mediaproxy = {
|
|
|
|
|
static struct xtables_target mediaproxy4 = {
|
|
|
|
|
.name = "MEDIAPROXY",
|
|
|
|
|
.family = NFPROTO_IPV4,
|
|
|
|
|
.version = XTABLES_VERSION,
|
|
|
|
|
.size = XT_ALIGN(sizeof(struct ipt_mediaproxy_info)),
|
|
|
|
|
.userspacesize = XT_ALIGN(sizeof(struct ipt_mediaproxy_info)),
|
|
|
|
|
.size = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
|
|
|
|
|
.userspacesize = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
|
|
|
|
|
.help = help,
|
|
|
|
|
.parse = parse,
|
|
|
|
|
.final_check = final_check,
|
|
|
|
|
.print = print,
|
|
|
|
|
.save = save,
|
|
|
|
|
.extra_opts = opts,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct xtables_target mediaproxy6 = {
|
|
|
|
|
.name = "MEDIAPROXY",
|
|
|
|
|
.family = NFPROTO_IPV6,
|
|
|
|
|
.version = XTABLES_VERSION,
|
|
|
|
|
.size = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
|
|
|
|
|
.userspacesize = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
|
|
|
|
|
.help = help,
|
|
|
|
|
.parse = parse,
|
|
|
|
|
.final_check = final_check,
|
|
|
|
|
@ -77,5 +92,6 @@ static struct xtables_target mediaproxy = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void _init(void) {
|
|
|
|
|
xtables_register_target(&mediaproxy);
|
|
|
|
|
xtables_register_target(&mediaproxy4);
|
|
|
|
|
xtables_register_target(&mediaproxy6);
|
|
|
|
|
}
|
|
|
|
|
|