{"id":6,"date":"2007-08-25T01:46:55","date_gmt":"2007-08-25T01:46:55","guid":{"rendered":"http:\/\/www.noidea.us\/wordpress\/?p=6"},"modified":"2012-02-29T21:24:01","modified_gmt":"2012-03-01T05:24:01","slug":"linux-traffic-shaping-in-fedora-core-4","status":"publish","type":"post","link":"http:\/\/www.noidea.us\/wordpress\/2007\/08\/linux-traffic-shaping-in-fedora-core-4\/","title":{"rendered":"Linux traffic shaping in Fedora Core 4"},"content":{"rendered":"<p><![CDATA[Before I switched to the new mail server, I was running <a href=\"http:\/\/freshmeat.net\/projects\/cbq.init\">CBQ.init<\/a> to do some limiting of outbound SMTP traffic.  You see, I run a mailing list that has multiple large attachments that are resent to 50+ subscribers, and trying to send that out effectively kills my DSL line.  \n\n\nWhen I set up the new server, I set up CBQ.init 0.7.3 using the same configuration as on the old (Fedora Core 1) machine.  Today, I found out that my limiting was not working&#8230;seems that there is an error in the CBQ.init script that prevented it from running correctly.  The error manifests as follows:\n\n\n<code><br \/>\n[root@server rc.d]# .\/cbq.init compile<br \/>\nfind: warning: you have specified the -maxdepth option after a non-option argument (, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.\n\n\nfind: warning: you have specified the -maxdepth option after a non-option argument (, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.<br \/>\n<\/code>\n\n\nThe error is actually a mistake in the <b>find<\/b> command syntax of two lines in the script.\n\n\nHere is the corrected script (those are line numbers in front).\n\n\n<code><br \/>\n    577          ### Get a list of configured classes<br \/>\n    578         CLASSLIST=`find $1 -maxdepth 1 \\( -type f -or -type l\\ ) -name 'cbq-*' \\<br \/>\n    579                 -not -name '*~' -printf \"%f\\n\"| sort`<br \/>\n    580         [ -z \"$CLASSLIST\" ] &&<br \/>\n    581                 cbq_failure \"no configuration files found in $1!\"<br \/>\n    582<br \/>\n    583         ### Gather all DEVICE fields from $1\/cbq-*<br \/>\n    584         DEVFIELDS=`find $1 -maxdepth 1 \\( -type f -or -type l \\) -name 'cbq-*' \\<br \/>\n    585                   -not -name '*~'| xargs sed -n 's\/#.*\/\/; <br \/>\n    586                   s\/[[:space:]]\/\/g; \/^DEVICE=[^,]*,[^,]*(,[^,]*)?\/ \\<br \/>\n    587                   { s\/.*=\/\/; p; }'| sort -u`<br \/>\n<\/code>\n\n\nThe change is the location of the <i>-maxdepth 1<\/i> argument: it must be immediately after the last path in the statement, and before any other options.  The original looked like this:\n\n\n<code><br \/>\n\t### Get a list of configured classes<br \/>\n\tCLASSLIST=`find $1 \\( -type f -or -type l \\) -name 'cbq-*' \\<br \/>\n\t\t-not -name '*~' <b>-maxdepth 1<\/b> -printf \"%f\\n\"| sort`<br \/>\n\t[ -z \"$CLASSLIST\" ] &&<br \/>\n\t\tcbq_failure \"no configuration files found in $1!\"\n\n\n\t### Gather all DEVICE fields from $1\/cbq-*<br \/>\n\tDEVFIELDS=`find $1 ( -type f -or -type l ) -name 'cbq-*' \\<br \/>\n\t\t  -not -name '*~' <b>-maxdepth 1<\/b>| xargs sed -n 's\/#.*\/\/; \\<br \/>\n\t\t  s\/[[:space:]]\/\/g; \/^DEVICE=[^,]*,[^,]*\\(,[^,]*\\)\\?\/ \\<br \/>\n\t\t  { s\/.*=\/\/; p; }'| sort -u`<br \/>\n<\/code>\n\n\nAfter making this change, the script works as expected!  I&#8217;m posting this on the off-chance that someone else might be having the same issue I did, and this will help them, too.\n\n\nOh, and if anyone is interested, here is my script to limit SMTP outbound traffic on my 3Mbit\/768Kbit DSL line.  It&#8217;s called <b>cbq-0256.SMTP-out<\/b>:\n\n\n<code><br \/>\nDEVICE=eth1,3Mbit,384Kbit<br \/>\nRATE=256Kbit<br \/>\nWEIGHT=25Kbit<br \/>\nRULE=,:25<br \/>\n<\/code>\n\n\nGood luck!]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CBQ.init to do some limiting of outbound SMTP traffic. You see, I run a mailing list that has multiple large attachments that are resent to 50+ subscribers, and trying to send that out effectively kills my DSL line. When I set up the new server, I set up CBQ.init 0.7.3 using the same configuration as [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":1,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":69,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/posts\/6\/revisions\/69"}],"wp:attachment":[{"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.noidea.us\/wordpress\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}