SOURCES (LINUX_2_6): iptables-nf-comment.patch (NEW) - [submitted]...
cieciwa
cieciwa at pld-linux.org
Thu Sep 15 09:39:12 CEST 2005
Author: cieciwa Date: Thu Sep 15 07:39:12 2005 GMT
Module: SOURCES Tag: LINUX_2_6
---- Log message:
- [submitted] comment - iptables patch.
---- Files affected:
SOURCES:
iptables-nf-comment.patch (NONE -> 1.1.2.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/iptables-nf-comment.patch
diff -u /dev/null SOURCES/iptables-nf-comment.patch:1.1.2.1
--- /dev/null Thu Sep 15 09:39:12 2005
+++ SOURCES/iptables-nf-comment.patch Thu Sep 15 09:39:07 2005
@@ -0,0 +1,115 @@
+ .comment-test | 2 +
+ libipt_comment.c | 58 ++++++++++++++++++++++++++++++-------------------------
+ 2 files changed, 34 insertions(+), 26 deletions(-)
+
+diff -Nur iptables.org/extensions/.comment-test iptables/extensions/.comment-test
+--- iptables.org/extensions/.comment-test 1970-01-01 01:00:00.000000000 +0100
++++ iptables/extensions/.comment-test 2005-09-15 08:20:04.000000000 +0200
+@@ -0,0 +1,2 @@
++#!/bin/sh
++[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_comment.h ] && echo comment
+diff -Nur iptables.org/extensions/libipt_comment.c iptables/extensions/libipt_comment.c
+--- iptables.org/extensions/libipt_comment.c 2005-09-15 08:05:41.000000000 +0200
++++ iptables/extensions/libipt_comment.c 2005-09-15 08:20:04.000000000 +0200
+@@ -1,5 +1,5 @@
+-/* Shared library add-on to iptables to add comment match support.
+- *
++/* Shared library add-on to iptables to add comment match support.
++ *
+ * ChangeLog
+ * 2003-05-13: Brad Fisher <brad at info-link.net>
+ * Initial comment match
+@@ -29,16 +29,24 @@
+ {0}
+ };
+
++/* Initialize the match. */
+ static void
+-parse_comment(const char *s, struct ipt_comment_info *info)
++init(struct ipt_entry_match *m, unsigned int *nfcache)
++{
++ *nfcache |= NFC_UNKNOWN;
++}
++
++static void
++parse_comment(const unsigned char *s, struct ipt_comment_info *info)
+ {
+ int slen = strlen(s);
+
+- if (slen >= IPT_MAX_COMMENT_LEN) {
++ if (slen > IPT_MAX_COMMENT_LEN) {
+ exit_error(PARAMETER_PROBLEM,
+ "COMMENT must be shorter than %i characters", IPT_MAX_COMMENT_LEN);
+ }
+- strcpy((char *)info->comment, s);
++
++ strcpy(info->comment, s);
+ }
+
+ /* Function which parses command options; returns true if it
+@@ -53,11 +61,12 @@
+
+ switch (c) {
+ case '1':
+- check_inverse(argv[optind-1], &invert, &optind, 0);
++ check_inverse(optarg, &invert, &optind, 0);
+ if (invert) {
+ exit_error(PARAMETER_PROBLEM,
+ "Sorry, you can't have an inverted comment");
+ }
++
+ parse_comment(argv[optind-1], commentinfo);
+ *flags = 1;
+ break;
+@@ -83,34 +92,31 @@
+ const struct ipt_entry_match *match,
+ int numeric)
+ {
+- struct ipt_comment_info *commentinfo = (struct ipt_comment_info *)match->data;
+-
+- commentinfo->comment[IPT_MAX_COMMENT_LEN-1] = '\0';
+- printf("/* %s */ ", commentinfo->comment);
++ printf("/* %s */ ", ((struct ipt_comment_info *)match->data)->comment);
+ }
+
+ /* Saves the union ipt_matchinfo in parsable form to stdout. */
+ static void
+ save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
+ {
+- struct ipt_comment_info *commentinfo = (struct ipt_comment_info *)match->data;
+-
+- commentinfo->comment[IPT_MAX_COMMENT_LEN-1] = '\0';
+- printf("--comment \"%s\" ", commentinfo->comment);
++/* I wonder whether this works? */
++ printf("--comment \"%s\" ", ((struct ipt_comment_info *)match->data)->comment );
+ }
+
+-static struct iptables_match comment = {
+- .next = NULL,
+- .name = "comment",
+- .version = IPTABLES_VERSION,
+- .size = IPT_ALIGN(sizeof(struct ipt_comment_info)),
+- .userspacesize = IPT_ALIGN(sizeof(struct ipt_comment_info)),
+- .help = &help,
+- .parse = &parse,
+- .final_check = &final_check,
+- .print = &print,
+- .save = &save,
+- .extra_opts = opts
++static
++struct iptables_match comment
++= { .next = NULL,
++ .name = "comment",
++ .version = IPTABLES_VERSION,
++ .size = IPT_ALIGN(sizeof(struct ipt_comment_info)),
++ .userspacesize = IPT_ALIGN(sizeof(struct ipt_comment_info)),
++ .help = &help,
++ .init = &init,
++ .parse = &parse,
++ .final_check = &final_check,
++ .print = &print,
++ .save = &save,
++ .extra_opts = opts
+ };
+
+ void _init(void)
================================================================
More information about the pld-cvs-commit
mailing list