source: freewrt/package/iptables/patches/05-imq1.patch@ ca629a6

freewrt_1_0 freewrt_2_0
Last change on this file since ca629a6 was ca629a6, checked in by Dirk Nehring <dnehring@…>, 17 years ago

Update iptables to 1.3.8

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3769 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 5.6 KB
  • iptables-1.3.6

    old new  
     1#!/bin/sh
     2# True if IMQ target patch is applied.
     3[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ
  • libip6t_IMQ.c

    old new  
     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. */
     12static void
     13help(void)
     14{
     15        printf(
     16"IMQ target v%s options:\n"
     17"  --todev <N>          enqueue to imq<N>, defaults to 0\n",
     18IPTABLES_VERSION);
     19}
     20
     21static struct option opts[] = {
     22        { "todev", 1, 0, '1' },
     23        { 0 }
     24};
     25
     26/* Initialize the target. */
     27static void
     28init(struct ip6t_entry_target *t, unsigned int *nfcache)
     29{
     30        struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
     31
     32        mr->todev = 0;
     33        *nfcache |= NFC_UNKNOWN;
     34}
     35
     36/* Function which parses command options; returns true if it
     37   ate an option */
     38static int
     39parse(int c, char **argv, int invert, unsigned int *flags,
     40      const struct ip6t_entry *entry,
     41      struct ip6t_entry_target **target)
     42{
     43        struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
     44       
     45        switch(c) {
     46        case '1':
     47                if (check_inverse(optarg, &invert, NULL, 0))
     48                        exit_error(PARAMETER_PROBLEM,
     49                                   "Unexpected `!' after --todev");
     50                mr->todev=atoi(optarg);
     51                break;
     52        default:
     53                return 0;
     54        }
     55        return 1;
     56}
     57
     58static void
     59final_check(unsigned int flags)
     60{
     61}
     62
     63/* Prints out the targinfo. */
     64static void
     65print(const struct ip6t_ip6 *ip,
     66      const struct ip6t_entry_target *target,
     67      int numeric)
     68{
     69        struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
     70
     71        printf("IMQ: todev %u ", mr->todev);
     72}
     73
     74/* Saves the union ipt_targinfo in parsable form to stdout. */
     75static void
     76save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
     77{
     78        struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
     79
     80        printf("--todev %u", mr->todev);
     81}
     82
     83static struct ip6tables_target imq = {
     84        .next           = NULL,
     85        .name           = "IMQ",
     86        .version        = IPTABLES_VERSION,
     87        .size           = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
     88        .userspacesize  = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
     89        .help           = &help,
     90        .init           = &init,
     91        .parse          = &parse,
     92        .final_check    = &final_check,
     93        .print          = &print,
     94        .save           = &save,
     95        .extra_opts     = opts
     96};
     97
     98static __attribute__((constructor)) void _init(void)
     99{
     100        register_target6(&imq);
     101}
  • iptables-1.3.6

    old new  
     1#!/bin/sh
     2# True if IMQ target patch is applied.
     3[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ
  • iptables-1.3.6

    old new  
     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. */
     12static void
     13help(void)
     14{
     15        printf(
     16"IMQ target v%s options:\n"
     17"  --todev <N>          enqueue to imq<N>, defaults to 0\n",
     18IPTABLES_VERSION);
     19}
     20
     21static struct option opts[] = {
     22        { "todev", 1, 0, '1' },
     23        { 0 }
     24};
     25
     26/* Initialize the target. */
     27static void
     28init(struct ipt_entry_target *t, unsigned int *nfcache)
     29{
     30        struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
     31
     32        mr->todev = 0;
     33        *nfcache |= NFC_UNKNOWN;
     34}
     35
     36/* Function which parses command options; returns true if it
     37   ate an option */
     38static int
     39parse(int c, char **argv, int invert, unsigned int *flags,
     40      const struct ipt_entry *entry,
     41      struct ipt_entry_target **target)
     42{
     43        struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
     44       
     45        switch(c) {
     46        case '1':
     47                if (check_inverse(optarg, &invert, NULL, 0))
     48                        exit_error(PARAMETER_PROBLEM,
     49                                   "Unexpected `!' after --todev");
     50                mr->todev=atoi(optarg);
     51                break;
     52        default:
     53                return 0;
     54        }
     55        return 1;
     56}
     57
     58static void
     59final_check(unsigned int flags)
     60{
     61}
     62
     63/* Prints out the targinfo. */
     64static void
     65print(const struct ipt_ip *ip,
     66      const struct ipt_entry_target *target,
     67      int numeric)
     68{
     69        struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
     70
     71        printf("IMQ: todev %u ", mr->todev);
     72}
     73
     74/* Saves the union ipt_targinfo in parsable form to stdout. */
     75static void
     76save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
     77{
     78        struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
     79
     80        printf("--todev %u", mr->todev);
     81}
     82
     83static struct iptables_target imq = {
     84        .next           = NULL,
     85        .name           = "IMQ",
     86        .version        = IPTABLES_VERSION,
     87        .size           = IPT_ALIGN(sizeof(struct ipt_imq_info)),
     88        .userspacesize  = IPT_ALIGN(sizeof(struct ipt_imq_info)),
     89        .help           = &help,
     90        .init           = &init,
     91        .parse          = &parse,
     92        .final_check    = &final_check,
     93        .print          = &print,
     94        .save           = &save,
     95        .extra_opts     = opts
     96};
     97
     98static __attribute__((constructor)) void _init(void)
     99{
     100        register_target(&imq);
     101}
Note: See TracBrowser for help on using the repository browser.