--- accounting.orig	2007-02-23 21:07:02.000000000 +0100
+++ accounting	2007-04-26 10:47:55.000000000 +0200
@@ -7,6 +7,6 @@
 # additional information about how to use this file.
 #
 #####################################################################################
-#ACTION	CHAIN	SOURCE		DESTINATION	PROTO	DEST		SOURCE	USER/
+#ACTION	CHAIN	SOURCE		DESTINATION	PROTO	DEST		SOURCE	USER/	MARK
 #							PORT(S)		PORT(S)	GROUP
 #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
--- manpages/shorewall-accounting.5.orig	2007-04-02 01:45:18.000000000 +0200
+++ manpages/shorewall-accounting.5	2007-04-26 10:51:47.000000000 +0200
@@ -117,6 +117,11 @@
 Netfilter in kernel version 2.6.14.
 .RE
 .RE
+.TP
+\fBMARK\fR (Optional) \(em [[\fB!\fR]\fImark\fR[\fB/\fR\fImasq\fR]]
+If you wish to restrict this entry to packets marked with a particular mark value.
+mark/mask values are acceptable.
+You can prepend "!" to the mark value to invert the sense of this rule.
 .PP
 In all of the above columns except \fBACTION\fR and \fBCHAIN\fR,
 the values \fB-\fR, \fBany\fR and \fBall\fR may be
--- lib.accounting.orig	2007-04-26 10:51:55.000000000 +0200
+++ lib.accounting	2007-04-26 10:53:34.000000000 +0200
@@ -35,11 +35,11 @@
     user1=
 
     accounting_error() {
-	error_message "WARNING: Invalid Accounting rule" $action $chain $source $dest $proto $port $sport $user
+	error_message "WARNING: Invalid Accounting rule" $action $chain $source $dest $proto $port $sport $user $mark
     }
 
     accounting_interface_error() {
-	error_message "WARNING: Unknown interface $1 in " $action $chain $source $dest $proto $port $sport $user
+	error_message "WARNING: Unknown interface $1 in " $action $chain $source $dest $proto $port $sport $user $mark
     }
 
     accounting_interface_verify() {
@@ -195,6 +195,18 @@
 	    ;;
     esac
 
+    [ -n "$mark" ] && case $mark in
+        -|any|all)
+            mark=
+            ;;
+        !*)
+            rule="$rule -m mark ! --mark ${mark#*!}"
+            ;;
+        *)
+            rule="$rule -m mark --mark $mark"
+            ;;
+    esac
+
     case $action in
 	COUNT)
 	    ;;
@@ -239,7 +251,7 @@
 
     save_progress_message "Setting up Accounting..."
 
-    while read action chain source dest proto port sport user ; do
+    while read action chain source dest proto port sport user mark ; do
 	process_accounting_rule
     done < $TMP_DIR/accounting
 
