Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 203517
Collapse All | Expand All

(-)iptables-1.4.0.orig/extensions.orig/.IMQ-test6 (+3 lines)
Line 0 Link Here
1
#!/bin/sh
2
# True if IMQ target patch is applied.
3
[ -f $KERNEL_DIR/include/linux/netfilter_ipv6/ip6t_IMQ.h ] && echo IMQ
(-)iptables-1.4.0.orig/extensions.orig/libip6t_IMQ.c (+100 lines)
Line 0 Link Here
1
/* Shared library add-on to iptables to add IMQ target support. */
2
#include <stdio.h>
3
#include <string.h>
4
#include <stdlib.h>
5
#include <getopt.h>
6
7
#include <ip6tables.h>
8
#include <linux/netfilter_ipv6/ip6_tables.h>
9
#include <linux/netfilter_ipv6/ip6t_IMQ.h>
10
11
/* Function which prints out usage message. */
12
static void
13
help(void)
14
{
15
	printf(
16
"IMQ target v%s options:\n"
17
"  --todev <N>		enqueue to imq<N>, defaults to 0\n", 
18
IPTABLES_VERSION);
19
}
20
21
static struct option opts[] = {
22
	{ "todev", 1, 0, '1' },
23
	{ 0 }
24
};
25
26
/* Initialize the target. */
27
static void
28
init(struct xt_entry_target *t)
29
{
30
	struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
31
32
	mr->todev = 0;
33
}
34
35
/* Function which parses command options; returns true if it
36
   ate an option */
37
static int
38
parse(int c, char **argv, int invert, unsigned int *flags,
39
      const void *entry,
40
      struct xt_entry_target **target)
41
{
42
	struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
43
	
44
	switch(c) {
45
	case '1':
46
		if (check_inverse(optarg, &invert, NULL, 0))
47
			exit_error(PARAMETER_PROBLEM,
48
				   "Unexpected `!' after --todev");
49
		mr->todev=atoi(optarg);
50
		break;
51
	default:
52
		return 0;
53
	}
54
	return 1;
55
}
56
57
static void
58
final_check(unsigned int flags)
59
{
60
}
61
62
/* Prints out the targinfo. */
63
static void
64
print(const void *ip,
65
      const struct xt_entry_target *target,
66
      int numeric)
67
{
68
	struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
69
70
	printf("IMQ: todev %u ", mr->todev);
71
}
72
73
/* Saves the union ipt_targinfo in parsable form to stdout. */
74
static void
75
save(const void *ip, const struct xt_entry_target *target)
76
{
77
	struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
78
79
	printf("--todev %u", mr->todev);
80
}
81
82
static struct ip6tables_target imq = {
83
	.next		= NULL,
84
	.name		= "IMQ",
85
	.version	= IPTABLES_VERSION,
86
	.size		= IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
87
	.userspacesize	= IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
88
	.help		= &help,
89
	.init		= &init,
90
	.parse		= &parse,
91
	.final_check	= &final_check,
92
	.print		= &print,
93
	.save		= &save,
94
	.extra_opts	= opts
95
};
96
97
static __attribute__((constructor)) void _init(void)
98
{
99
	register_target6(&imq);
100
}
(-)iptables-1.4.0.orig/extensions.orig/.IMQ-test (+3 lines)
Line 0 Link Here
1
#!/bin/sh
2
# True if IMQ target patch is applied.
3
[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_IMQ.h ] && echo IMQ
(-)iptables-1.4.0.orig/extensions.orig/libipt_IMQ.c (+100 lines)
Line 0 Link Here
1
/* Shared library add-on to iptables to add IMQ target support. */
2
#include <stdio.h>
3
#include <string.h>
4
#include <stdlib.h>
5
#include <getopt.h>
6
7
#include <iptables.h>
8
#include <linux/netfilter_ipv4/ip_tables.h>
9
#include <linux/netfilter_ipv4/ipt_IMQ.h>
10
11
/* Function which prints out usage message. */
12
static void
13
help(void)
14
{
15
	printf(
16
"IMQ target v%s options:\n"
17
"  --todev <N>		enqueue to imq<N>, defaults to 0\n", 
18
IPTABLES_VERSION);
19
}
20
21
static struct option opts[] = {
22
	{ "todev", 1, 0, '1' },
23
	{ 0 }
24
};
25
26
/* Initialize the target. */
27
static void
28
init(struct xt_entry_target *t)
29
{
30
	struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
31
32
	mr->todev = 0;
33
}
34
35
/* Function which parses command options; returns true if it
36
   ate an option */
37
static int
38
parse(int c, char **argv, int invert, unsigned int *flags,
39
      const void *entry,
40
      struct xt_entry_target **target)
41
{
42
	struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
43
	
44
	switch(c) {
45
	case '1':
46
		if (check_inverse(optarg, &invert, NULL, 0))
47
			exit_error(PARAMETER_PROBLEM,
48
				   "Unexpected `!' after --todev");
49
		mr->todev=atoi(optarg);
50
		break;
51
	default:
52
		return 0;
53
	}
54
	return 1;
55
}
56
57
static void
58
final_check(unsigned int flags)
59
{
60
}
61
62
/* Prints out the targinfo. */
63
static void
64
print(const void *ip,
65
      const struct xt_entry_target *target,
66
      int numeric)
67
{
68
	struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
69
70
	printf("IMQ: todev %u ", mr->todev);
71
}
72
73
/* Saves the union ipt_targinfo in parsable form to stdout. */
74
static void
75
save(const void *ip, const struct xt_entry_target *target)
76
{
77
	struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
78
79
	printf("--todev %u", mr->todev);
80
}
81
82
static struct iptables_target imq = {
83
	.next		= NULL,
84
	.name		= "IMQ",
85
	.version	= IPTABLES_VERSION,
86
	.size		= IPT_ALIGN(sizeof(struct ipt_imq_info)),
87
	.userspacesize	= IPT_ALIGN(sizeof(struct ipt_imq_info)),
88
	.help		= &help,
89
	.init		= &init,
90
	.parse		= &parse,
91
	.final_check	= &final_check,
92
	.print		= &print,
93
	.save		= &save,
94
	.extra_opts	= opts
95
};
96
97
static __attribute__((constructor)) void _init(void)
98
{
99
	register_target(&imq);
100
}

Return to bug 203517