<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<title>Re: filter all prefixes except a few with 'case' control</title>
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-believe-normal-left:yes;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.rvps1, li.rvps1, div.rvps1
{mso-style-name:rvps1;
margin:0cm;
margin-bottom:.0001pt;
text-align:center;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.rvts1
{mso-style-name:rvts1;
font-family:"Arial",sans-serif;
color:blue;
font-weight:bold;}
span.rvts2
{mso-style-name:rvts2;
font-family:"Arial",sans-serif;
color:navy;
font-weight:bold;}
span.rvts3
{mso-style-name:rvts3;
font-family:"Arial",sans-serif;
color:maroon;
font-style:italic;}
span.rvts4
{mso-style-name:rvts4;
font-family:"Arial",sans-serif;
color:green;
text-decoration:underline;}
span.rvts5
{mso-style-name:rvts5;
font-family:"Arial",sans-serif;
color:green;
text-decoration:underline;}
span.rvts6
{mso-style-name:rvts6;
font-family:"Calibri",sans-serif;}
span.rvts7
{mso-style-name:rvts7;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.rvts8
{mso-style-name:rvts8;
font-family:"Calibri",sans-serif;
color:#0563C1;
text-decoration:underline;}
span.rvts9
{mso-style-name:rvts9;
font-family:"Calibri",sans-serif;
color:#0563C1;
font-style:italic;
text-decoration:underline;}
span.rvts10
{mso-style-name:rvts10;
font-family:"Calibri",sans-serif;
color:silver;
font-style:italic;}
span.EmailStyle30
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><![if mso 9]><style>p.MsoNormal
{margin-left:3.75pt;}
</style><![endif]><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="RU" link="blue" vlink="purple" style="margin-left:3.75pt;margin-top:3.75pt;margin-right:3.75pt;margin-bottom:3.75pt">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Construction with single IP addresses passes syntax check, but filter does not work as expected – it passes all routes
and does not filter anything. I have ugly workaround which works:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-right:3.75pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US">filter permit_white {<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> if net = 1.1.1.1/32 then {<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> accept;<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> if net = 2.2.2.2/32 then {<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> accept;<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> else {<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> reject;<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:3.75pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">There are no examples on the internet with ‘case’ statement, seems the feature is rarely used and even implemented with
some mistakes, isn’t it?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">ROA table would be helpful, but if I understood this feature correctly, it is used for BGP, but in my case I use OSPF
only.<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Служба поддержки серверов<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Группа сетевого администрирования<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">ДПП.УТП.СПС<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">ЗАО ПФ «СКБ-Контур»,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Тел. +7 (343) 344-11-50 доб. 75352<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">e</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">mail</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">:
<a href="mailto:dc-noc@skbkontur.ru"><span lang="EN-US" style="color:#0563C1">dc</span><span style="color:#0563C1">-</span><span lang="EN-US" style="color:#0563C1">noc</span><span style="color:#0563C1">@</span><span lang="EN-US" style="color:#0563C1">skbkontur</span><span style="color:#0563C1">.</span><span lang="EN-US" style="color:#0563C1">ru</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><a href="https://www.kontur.ru/"><i><span lang="EN-US" style="color:#0563C1">https</span></i><i><span style="color:#0563C1">://</span></i><i><span lang="EN-US" style="color:#0563C1">www</span></i><i><span style="color:#0563C1">.</span></i><i><span lang="EN-US" style="color:#0563C1">kontur</span></i><i><span style="color:#0563C1">.</span></i><i><span lang="EN-US" style="color:#0563C1">ru</span></i></a><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Василий Олейников [mailto:oleynikov_v@ufanet.ru]
<br>
<b>Sent:</b> Thursday, September 29, 2016 11:45 AM<br>
<b>To:</b> Войнович Андрей Александрович <andreyv@skbkontur.ru><br>
<b>Cc:</b> bird-users@network.cz<br>
<b>Subject:</b> Re: filter all prefixes except a few with 'case' control<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black">It seems, that case doesn't work with prefix, only with single ip<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black">As I see, this construct:<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"> case net {<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"> 1.1.1.1:accept;<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"> 2.2.2.2:accept;<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"> else: reject;<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black">works fine.<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black">Maybe, ROA table can help you to simplify config?<o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<div>
<table class="MsoNormalTable" border="0" cellpadding="0" style="background:white">
<tbody>
<tr>
<td width="1" valign="top" style="width:.75pt;background:blue;padding:.75pt .75pt .75pt .75pt">
</td>
<td width="1108" valign="top" style="width:831.0pt;padding:.75pt .75pt .75pt .75pt">
<p><span class="rvts6"><span style="font-size:11.0pt;color:black">Hi all!</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black">I try to implement simple filter which rejects all prefixes except a few with 'case' control this way:</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black">filter permit_white {</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> case net {</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> 1.1.1.1/32: accept;</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> 2.2.2.2/32: accept;</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> else: reject;</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> }</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black">}</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black">But syntax check fails on line ‘1.1.1.1/32: accept;’. I read everything on Internet what was found, but cannot understand what is wrong.</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">------------------------------------------</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">Служба поддержки серверов</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">Группа сетевого администрирования</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">ДПП.УТП.СПС</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">ЗАО ПФ «СКБ-Контур»,</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">Тел. +7 (343) 344-11-50 доб. 75352</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts7"><span style="font-size:11.0pt">e-mail: </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><a href="mailto:dc-noc@skbkontur.ru"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#0563C1">dc-noc@skbkontur.ru</span></a><o:p></o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><a href="https://www.kontur.ru/"><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#0563C1">https://www.kontur.ru</span></i></a><o:p></o:p></span></p>
<p><span class="rvts6"><span style="font-size:11.0pt;color:black"> </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">-- </span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">С уважением,</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">Василий Олейников</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">Системный администратор</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">Отдел эксплуатации и развития магистральной сети</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">Служба СПО ОАО "Уфанет"</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">тел. +7 (347) 2-900-402 вн.3314</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p><span class="rvts10"><span style="font-size:9.0pt">моб. +7 937 333 45 56</span></span><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</div>
</body>
</html>