I have this problem generating a file ..
I have 22 clases and foreach ip i have to generate those 3 lines. The problem is that from those 22 clases i have 3 clases..(6,17,19) that have 1 or 2 subclasses.. and the ip must be smth like 10.x.1.y or 10.x.2.y. So for 3 I have exceptions..
How can I fix this problem?
This is the code I wrote for all 22 classes with no exceptions.
my $DEV = "dev eth1";
my $count=500;
for ($x = 1;$x < 23;$x++) {
for ($y = 1;$y < 255;$y++) {
print HTB "\n class add $DEV parent 1:7 classid 1:0x".$count." rate
+4kbit ceil 512Kbit burst 4kbit prio 1 quantum 2000\n";
print HTB " filter add $DEV protocol ip parent 1:0 prio 1 u32 match
+ip dst 10.".$x.".0.".$y."/32 match ip src 0.0.0.0/0 flowid 1:0
x".$count."\n";
print HTB " qdisc add $DEV parent 1:0x".$count." handle 0x".$count++
+.": pfifo limit 5\n";
}
}
2006-02-10 Retitled by planetscape, as per Monastery guidelines
Original title: 'Generate problem'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.