packages: sort network related packages into package/network/
[openwrt.git] / package / network / utils / iproute2 / patches / 200-act_connmark.patch
1 --- a/tc/Makefile
2 +++ b/tc/Makefile
3 @@ -38,6 +38,7 @@ TCMODULES += m_mirred.o
4  TCMODULES += m_nat.o
5  TCMODULES += m_pedit.o
6  TCMODULES += m_skbedit.o
7 +TCMODULES += m_connmark.o
8  TCMODULES += m_csum.o
9  TCMODULES += p_ip.o
10  TCMODULES += p_icmp.o
11 --- /dev/null
12 +++ b/tc/m_connmark.c
13 @@ -0,0 +1,71 @@
14 +/*
15 + * m_connmark.c                Connection tracking marking import
16 + *
17 + * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
18 + *
19 + * This program is free software; you can redistribute it and/or modify it
20 + * under the terms and conditions of the GNU General Public License,
21 + * version 2, as published by the Free Software Foundation.
22 + *
23 + * This program is distributed in the hope it will be useful, but WITHOUT
24 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
26 + * more details.
27 + *
28 + * You should have received a copy of the GNU General Public License along with
29 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
30 + * Place - Suite 330, Boston, MA 02111-1307 USA.
31 + */
32 +
33 +#include <stdio.h>
34 +#include <stdlib.h>
35 +#include <unistd.h>
36 +#include <string.h>
37 +#include "utils.h"
38 +#include "tc_util.h"
39 +
40 +static void
41 +explain(void)
42 +{
43 +       fprintf(stderr, "Usage: ... connmark\n");
44 +}
45 +
46 +static void
47 +usage(void)
48 +{
49 +       explain();
50 +       exit(-1);
51 +}
52 +
53 +static int
54 +parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
55 +             struct nlmsghdr *n)
56 +{
57 +       int argc = *argc_p;
58 +       char **argv = *argv_p;
59 +
60 +       if (matches(*argv, "connmark") != 0)
61 +               return -1;
62 +
63 +       NEXT_ARG();
64 +
65 +       *argc_p = argc;
66 +       *argv_p = argv;
67 +       return 0;
68 +}
69 +
70 +static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
71 +{
72 +       if (arg == NULL)
73 +               return -1;
74 +
75 +       fprintf(f, " connmark");
76 +
77 +       return 0;
78 +}
79 +
80 +struct action_util connmark_action_util = {
81 +       .id = "connmark",
82 +       .parse_aopt = parse_connmark,
83 +       .print_aopt = print_connmark,
84 +};