<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<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:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.wordsection1Char
{mso-style-name:"wordsection1 Char";
mso-style-priority:99;
mso-style-link:wordsection1;
font-family:"Calibri",sans-serif;}
p.wordsection1, li.wordsection1, div.wordsection1
{mso-style-name:wordsection1;
mso-style-priority:99;
mso-style-link:"wordsection1 Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
span.kt
{mso-style-name:kt;}
span.nf
{mso-style-name:nf;}
span.p
{mso-style-name:p;}
span.k
{mso-style-name:k;}
span.n
{mso-style-name:n;}
span.o
{mso-style-name:o;}
span.cp
{mso-style-name:cp;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[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 lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi Team,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Had a doubt regarding Optimistic DAD implementation in linux kernel.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="wordsection1">The RFC of Optimistic DAD states:<o:p></o:p></p>
<p class="wordsection1"><o:p> </o:p></p>
<p class="wordsection1" style="text-indent:.5in">“Section 3.3<o:p></o:p></p>
<p class="wordsection1"><span style="font-family:"Courier New";color:black"> A router SHOULD NOT configure an Optimistic Address.”</span><span style="font-size:10.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">To check the same there is a condition in kernel code wherein we check if ipv6.devconf_all is set.<o:p></o:p></p>
<p class="MsoNormal">Now, my query is that we are checking if forwarding is enabled on all interfaces, then we consider the system to be a router.<o:p></o:p></p>
<p class="MsoNormal"><b>But even if forwarding is enabled from few interfaces(not all) isn’t the system behaving like a router?<o:p></o:p></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<pre style="margin-left:.5in"><span class="kt"><span style="color:#333399">void</span></span><span style="color:black"> </span><span class="nf"><span style="color:#0066BB"><a href="https://elixir.bootlin.com/linux/latest/ident/addrconf_add_linklocal"><b><span style="background:#F4F6FF">addrconf_add_linklocal</span></b></a></span></span><span class="p"><span style="color:#666666">(</span></span><span class="k"><span style="color:#008800">struct</span></span><span style="color:black"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/inet6_dev"><b><span style="background:#F4F6FF">inet6_dev</span></b></a></span> </span><span class="o"><span style="color:#666666">*</span></span><span class="n"><span style="color:black"><a href="https://elixir.bootlin.com/linux/latest/ident/idev"><b><span style="background:#F4F6FF">idev</span></b></a></span></span><span class="p"><span style="color:#666666">,</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> </span><span class="k"><span style="color:#008800">const</span></span><span style="color:black"> </span><span class="k"><span style="color:#008800">struct</span></span><span style="color:black"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/in6_addr"><b><span style="background:#F4F6FF">in6_addr</span></b></a></span> </span><span class="o"><span style="color:#666666">*</span></span><span class="n"><span style="color:black">addr</span></span><span class="p"><span style="color:#666666">,</span></span><span style="color:black"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/u32"><b><span style="background:#F4F6FF">u32</span></b></a></span> <span class="n">flags</span></span><span class="p"><span style="color:#666666">)</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span class="p"><span style="color:#666666">{</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:.5in"><span class="cp"><span style="color:#557799">#<a href="https://elixir.bootlin.com/linux/latest/ident/ifdef"><b><span style="background:#F4F6FF">ifdef</span></b></a> CONFIG_IPV6_OPTIMISTIC_DAD</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> </span><span class="k"><span style="color:#008800">if</span></span><span style="color:black"> </span><span class="p"><span style="color:#666666">((</span></span><span class="n"><span style="color:black"><a href="https://elixir.bootlin.com/linux/latest/ident/dev_net"><b><span style="background:#F4F6FF">dev_net</span></b></a></span></span><span class="p"><span style="color:#666666">(</span></span><span class="n"><span style="color:black"><a href="https://elixir.bootlin.com/linux/latest/ident/idev"><b><span style="background:#F4F6FF">idev</span></b></a></span></span><span class="o"><span style="color:#666666">-></span></span><span class="n"><span style="color:black">dev</span></span><span class="p"><span style="color:#666666">)</span></span><span class="o"><span style="color:#666666">-></span></span><span class="n"><span style="color:black">ipv6</span></span><span class="p"><span style="color:#666666">.</span></span><span class="n"><span style="color:black">devconf_all</span></span><span class="o"><span style="color:#666666">-></span></span><span class="n"><span style="color:black">optimistic_dad</span></span><span style="color:black"> </span><span class="o"><span style="color:#666666">||</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/idev"><b><span style="background:#F4F6FF">idev</span></b></a></span></span><span class="o"><span style="color:#666666">-></span></span><span class="n"><span style="color:black">cnf</span></span><span class="p"><span style="color:#666666">.</span></span><span class="n"><span style="color:black">optimistic_dad</span></span><span class="p"><span style="color:#666666">)</span></span><span style="color:black"> </span><span class="o"><span style="color:#666666">&&</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> </span><span class="o"><span style="color:#666666;background:yellow;mso-highlight:yellow">!</span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow"><a href="https://elixir.bootlin.com/linux/latest/ident/dev_net"><b>dev_net</b></a></span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">(</span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow"><a href="https://elixir.bootlin.com/linux/latest/ident/idev"><b>idev</b></a></span></span><span class="o"><span style="color:#666666;background:yellow;mso-highlight:yellow">-></span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow">dev</span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">)</span></span><span class="o"><span style="color:#666666;background:yellow;mso-highlight:yellow">-></span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow">ipv6</span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">.</span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow">devconf_all</span></span><span class="o"><span style="color:#666666;background:yellow;mso-highlight:yellow">-></span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow"><a href="https://elixir.bootlin.com/linux/latest/ident/forwarding"><b>forwarding</b></a></span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">)</span></span><span style="color:black;background:yellow;mso-highlight:yellow"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black;background:yellow;mso-highlight:yellow"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/cfg"><b>cfg</b></a></span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">.</span></span><span class="n"><span style="color:black;background:yellow;mso-highlight:yellow">ifa_flags</span></span><span style="color:black;background:yellow;mso-highlight:yellow"> </span><span class="o"><span style="color:#666666;background:yellow;mso-highlight:yellow">|=</span></span><span style="color:black;background:yellow;mso-highlight:yellow"> <span class="n"><a href="https://elixir.bootlin.com/linux/latest/ident/IFA_F_OPTIMISTIC"><b>IFA_F_OPTIMISTIC</b></a></span></span><span class="p"><span style="color:#666666;background:yellow;mso-highlight:yellow">;</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span class="cp"><span style="color:#557799">#endif</span></span><span style="color:black"><o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span style="color:black"> .<o:p></o:p></span></pre>
<pre style="margin-left:.5in"><span class="p"><span style="color:#666666">}</span></span><span style="color:black"><o:p></o:p></span></pre>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks <o:p></o:p></p>
<p class="MsoNormal">Chinmay<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>