mirror of
https://gitlab.com/shorewall/code.git
synced 2025-02-22 04:31:23 +01:00
Implement 'show marks'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
4a7d4d6abc
commit
4d30811794
@ -432,6 +432,10 @@ sub generate_script_3($) {
|
||||
save_policies;
|
||||
emit_unindented '__EOF__';
|
||||
|
||||
emit 'cat > ${VARDIR}/marks << __EOF__';
|
||||
dump_mark_layout;
|
||||
emit_unindented '__EOF__';
|
||||
|
||||
pop_indent;
|
||||
|
||||
emit "fi\n";
|
||||
|
@ -126,6 +126,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
||||
run_user_exit1
|
||||
run_user_exit2
|
||||
generate_aux_config
|
||||
dump_mark_layout
|
||||
|
||||
$product
|
||||
$Product
|
||||
@ -3754,6 +3755,7 @@ sub get_configuration( $$$ ) {
|
||||
}
|
||||
|
||||
if ( ( my $userbits = $config{PROVIDER_OFFSET} - $config{TC_BITS} ) > 0 ) {
|
||||
|
||||
$globals{USER_MASK} = make_mask( $userbits ) << $config{TC_BITS};
|
||||
} else {
|
||||
$globals{USER_MASK} = 0;
|
||||
@ -4122,6 +4124,52 @@ sub generate_aux_config() {
|
||||
finalize_aux_config;
|
||||
}
|
||||
|
||||
sub dump_mark_layout() {
|
||||
sub dumpout( $$$$$ ) {
|
||||
my ( $name, $bits, $min, $max, $mask ) = @_;
|
||||
|
||||
if ( $bits ) {
|
||||
if ( $min == $max ) {
|
||||
emit_unindented "$name:" . $min . ' mask ' . in_hex( $mask );
|
||||
} else {
|
||||
emit_unindented "$name:" . join('-', $min, $max ) . ' (' . join( '-', in_hex( $min ), in_hex( $max ) ) . ') mask ' . in_hex( $mask );
|
||||
}
|
||||
} else {
|
||||
emit_unindented "$name: Not Enabled";
|
||||
}
|
||||
}
|
||||
|
||||
dumpout( "Traffic Shaping",
|
||||
$config{TC_BITS},
|
||||
0,
|
||||
$globals{TC_MAX},
|
||||
$globals{TC_MASK} );
|
||||
|
||||
dumpout( "User",
|
||||
$globals{USER_MASK},
|
||||
$globals{TC_MAX} + 1,
|
||||
$globals{USER_MASK},
|
||||
$globals{USER_MASK} );
|
||||
|
||||
dumpout( "Provider",
|
||||
$config{PROVIDER_BITS},
|
||||
$globals{PROVIDER_MIN},
|
||||
$globals{PROVIDER_MASK},
|
||||
$globals{PROVIDER_MASK} );
|
||||
|
||||
dumpout( "Zone",
|
||||
$config{ZONE_BITS},
|
||||
1 << $globals{ZONE_OFFSET},
|
||||
$globals{ZONE_MASK},
|
||||
$globals{ZONE_MASK} );
|
||||
|
||||
dumpout( "Exclusion",
|
||||
1,
|
||||
$globals{EXCLUSION_MASK},
|
||||
$globals{EXCLUSION_MASK},
|
||||
$globals{EXCLUSION_MASK} );
|
||||
}
|
||||
|
||||
END {
|
||||
cleanup;
|
||||
}
|
||||
|
@ -651,6 +651,7 @@ sub dump_zone_contents() {
|
||||
my $entry = "$zone $zonetypes{$type}";
|
||||
|
||||
$entry .= ":$zoneref->{bridge}" if $type & BPORT;
|
||||
$entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark};
|
||||
|
||||
if ( $hostref ) {
|
||||
for my $type ( sort keys %$hostref ) {
|
||||
|
@ -751,6 +751,12 @@ show_command() {
|
||||
[ $# -gt 1 ] && usage 1
|
||||
perip_accounting
|
||||
;;
|
||||
marks)
|
||||
[ $# -gt 1 ] && usage 1
|
||||
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
|
||||
echo
|
||||
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
|
||||
;;
|
||||
*)
|
||||
if [ "$g_product" = Shorewall ]; then
|
||||
case $1 in
|
||||
|
@ -1536,6 +1536,7 @@ usage() # $1 = exit status
|
||||
echo " show [ -m ] log [<regex>]"
|
||||
echo " show macro <macro>"
|
||||
echo " show macros"
|
||||
echo " show marks"
|
||||
echo " show [ -x ] mangle|nat|raw|rawpost|routing"
|
||||
echo " show policies"
|
||||
echo " show tc [ device ]"
|
||||
|
@ -710,6 +710,12 @@ show_command() {
|
||||
echo
|
||||
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies;
|
||||
;;
|
||||
marks)
|
||||
[ $# -gt 1 ] && usage 1
|
||||
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
|
||||
echo
|
||||
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
|
||||
;;
|
||||
*)
|
||||
if [ "$g_product" = Shorewall6 ]; then
|
||||
case $1 in
|
||||
|
@ -1530,6 +1530,7 @@ usage() # $1 = exit status
|
||||
echo " show [ -m ] log [<regex>]"
|
||||
echo " show macro <macro>"
|
||||
echo " show macros"
|
||||
echo " show marks"
|
||||
echo " show [ -x ] mangle|raw|routing"
|
||||
echo " show policies"
|
||||
echo " show tc [ device ]"
|
||||
|
@ -493,7 +493,7 @@
|
||||
<arg choice="plain"><option>show</option></arg>
|
||||
|
||||
<arg
|
||||
choice="req"><option>actions|classifiers|connections|config|filters|ip|ipa|macros|zones</option></arg>
|
||||
choice="req"><option>actions|classifiers|connections|config|filters|ip|ipa|macros|zones|policies|marks</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
@ -523,18 +523,6 @@
|
||||
<arg choice="req"><option>mangle|nat|routing|raw|rawpost</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>-<replaceable>options</replaceable></arg>
|
||||
|
||||
<arg choice="plain"><option>show</option></arg>
|
||||
|
||||
<arg choice="plain"><option>policies</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall</command>
|
||||
|
||||
@ -1368,15 +1356,12 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">mangle</emphasis></term>
|
||||
<term><emphasis role="bold">marks</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Displays the Netfilter mangle table using the command
|
||||
<emphasis role="bold">iptables -t mangle -L -n
|
||||
-v</emphasis>.The <emphasis role="bold">-x</emphasis> option
|
||||
is passed directly through to iptables and causes actual
|
||||
packet and byte counts to be displayed. Without this option,
|
||||
those counts are abbreviated.</para>
|
||||
<para>Added in Shorewall 4.4.26. Displays the various fields
|
||||
in packet marks giving the min and max value (in both decimal
|
||||
and hex) and the applicable mask (in hex).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -426,19 +426,7 @@
|
||||
<arg choice="plain"><option>show</option></arg>
|
||||
|
||||
<arg
|
||||
choice="req"><option>actions|classifiers|connections|config|filters|ip|macros|zones</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall6</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>-<replaceable>options</replaceable></arg>
|
||||
|
||||
<arg choice="plain"><option>show</option></arg>
|
||||
|
||||
<arg choice="plain"><option>policies</option></arg>
|
||||
choice="req"><option>actions|classifiers|connections|config|filters|ip|macros|zones|policies|tc|marks</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
@ -1223,6 +1211,16 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">marks</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.4.26. Displays the various fields
|
||||
in packet marks giving the min and max value (in both decimal
|
||||
and hex) and the applicable mask (in hex).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">policies</emphasis></term>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user