<!DOCTYPE html>
<html lang='en'>
<head>
<title>package - openwrt/upstream - upstream openwrt</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit.css'/>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='http://git.panaceas.org/cgit.cgi/openwrt/upstream/atom/package?h=v22.03.0-rc5' type='application/atom+xml'/>
<link rel='vcs-git' href='git://git.panaceas.org/openwrt/upstream' title='openwrt/upstream Git repository'/>
<link rel='vcs-git' href='ssh://git@git.panaceas.org/git/openwrt/upstream' title='openwrt/upstream Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit.cgi/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit.cgi/'>index</a> : <a title='openwrt/upstream' href='/cgit.cgi/openwrt/upstream/'>openwrt/upstream</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='ec5f168c668d93cbbe841fc8a6c11b53b33c2649'/><select name='h' onchange='this.form.submit();'>
<option value='attitude_adjustment'>attitude_adjustment</option>
<option value='barrier_breaker'>barrier_breaker</option>
<option value='chaos_calmer'>chaos_calmer</option>
<option value='lede-17.01'>lede-17.01</option>
<option value='less-old-master'>less-old-master</option>
<option value='master'>master</option>
<option value='old-master'>old-master</option>
<option value='openwrt-18.06'>openwrt-18.06</option>
<option value='openwrt-19.07'>openwrt-19.07</option>
<option value='upstream'>upstream</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>upstream openwrt</td><td class='sub right'>James</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/openwrt/upstream/about/?h=v22.03.0-rc5'>about</a><a href='/cgit.cgi/openwrt/upstream/?h=v22.03.0-rc5'>summary</a><a href='/cgit.cgi/openwrt/upstream/refs/?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>refs</a><a href='/cgit.cgi/openwrt/upstream/log/package?h=v22.03.0-rc5'>log</a><a class='active' href='/cgit.cgi/openwrt/upstream/tree/package?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>tree</a><a href='/cgit.cgi/openwrt/upstream/commit/package?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>commit</a><a href='/cgit.cgi/openwrt/upstream/diff/package?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>diff</a><a href='/cgit.cgi/openwrt/upstream/stats/package?h=v22.03.0-rc5'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/openwrt/upstream/log/package'>
<input type='hidden' name='h' value='v22.03.0-rc5'/><input type='hidden' name='id' value='ec5f168c668d93cbbe841fc8a6c11b53b33c2649'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/openwrt/upstream/tree/?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>root</a>/<a href='/cgit.cgi/openwrt/upstream/tree/package?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>package</a></div><div class='content'><table summary='tree listing' class='list'>
<tr class='nohover'><th class='left'>Mode</th><th class='left'>Name</th><th class='right'>Size</th><th/></tr>
<tr><td class='ls-mode'>-rw-r--r--</td><td><a class='ls-blob' href='/cgit.cgi/openwrt/upstream/tree/package/Makefile?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>Makefile</a></td><td class='ls-size'>1781</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/Makefile?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/Makefile?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/Makefile?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/acx-mac80211?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>acx-mac80211</a></td><td class='ls-size'>70</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/acx-mac80211?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/acx-mac80211?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/acx-mac80211?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/acx?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>acx</a></td><td class='ls-size'>70</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/acx?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/acx?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/acx?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/admswconfig?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>admswconfig</a></td><td class='ls-size'>102</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/admswconfig?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/admswconfig?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/admswconfig?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/alsa?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>alsa</a></td><td class='ls-size'>102</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/alsa?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/alsa?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/alsa?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/aodv-uu?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>aodv-uu</a></td><td class='ls-size'>102</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/aodv-uu?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/aodv-uu?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/aodv-uu?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/ar7-atm?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>ar7-atm</a></td><td class='ls-size'>70</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/ar7-atm?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/ar7-atm?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/ar7-atm?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/arptables?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>arptables</a></td><td class='ls-size'>70</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/arptables?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/arptables?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/arptables?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/b43?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>b43</a></td><td class='ls-size'>100</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/b43?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/b43?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/b43?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/base-files?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>base-files</a></td><td class='ls-size'>68</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/base-files?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/base-files?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/base-files?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/br2684ctl?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>br2684ctl</a></td><td class='ls-size'>102</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/br2684ctl?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/br2684ctl?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/br2684ctl?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/bridge-utils?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>bridge-utils</a></td><td class='ls-size'>70</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/bridge-utils?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/bridge-utils?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstream/plain/package/bridge-utils?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>plain</a></td></tr>
<tr><td class='ls-mode'>d---------</td><td><a class='ls-dir' href='/cgit.cgi/openwrt/upstream/tree/package/broadcom-diag?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>broadcom-diag</a></td><td class='ls-size'>66</td><td><a class='button' href='/cgit.cgi/openwrt/upstream/log/package/broadcom-diag?h=v22.03.0-rc5&amp;id=ec5f168c668d93cbbe841fc8a6c11b53b33c2649'>log</a><a class='button' href='/cgit.cgi/openwrt/upstream/stats/package/broadcom-diag?h=v22.03.0-rc5'>stats</a><a class='button' href='/cgit.cgi/openwrt/upstreamhe values from the config directly.
After running <span class="k">\texttt</span><span class="nb">{</span>scan<span class="k">\_</span>interfaces<span class="nb">}</span>, the <span class="k">\texttt</span><span class="nb">{</span>&#39;ifname&#39;<span class="nb">}</span> option will always contain
the effective interface name (which is used for IP traffic) and if the
physical device name differs from it, it will be stored in the <span class="k">\texttt</span><span class="nb">{</span>&#39;device&#39;<span class="nb">}</span>
option.
That means that running <span class="k">\texttt</span><span class="nb">{</span>config<span class="k">\_</span>get lan ifname<span class="nb">}</span>
after <span class="k">\texttt</span><span class="nb">{</span>scan<span class="k">\_</span>interfaces<span class="nb">}</span> might not return the same result as running it before.

After running <span class="k">\texttt</span><span class="nb">{</span>scan<span class="k">\_</span>interfaces<span class="nb">}</span>, the following functions are available:

<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
    <span class="k">\item</span><span class="nb">{</span><span class="k">\texttt</span><span class="nb">{</span>find<span class="k">\_</span>config <span class="k">\textit</span><span class="nb">{</span>interface<span class="nb">}}}</span> <span class="k">\\</span>
        looks for a network configuration that includes
        the specified network interface.

    <span class="k">\item</span><span class="nb">{</span><span class="k">\texttt</span><span class="nb">{</span>setup<span class="k">\_</span>interface <span class="k">\textit</span><span class="nb">{</span>interface [config] [protocol]<span class="nb">}}}</span> <span class="k">\\</span>
      will set up the specified interface, optionally overriding the network configuration
      name or the protocol that it uses.
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\subsubsection</span><span class="nb">{</span>Writing protocol handlers<span class="nb">}</span>

You can add custom protocol handlers (e.g: PPPoE, PPPoA, ATM, PPTP ...)
by adding shell scripts to <span class="k">\texttt</span><span class="nb">{</span>/lib/network<span class="nb">}</span>. They provide the following
two shell functions:

<span class="k">\begin</span><span class="nb">{</span>Verbatim<span class="nb">}</span>
scan<span class="nb">_</span>&lt;protocolname&gt;() <span class="nb">{</span>
    local config=&quot;<span class="s">$</span><span class="m">1</span><span class="nb">&quot;</span>
<span class="nb">    # change the interface names if necessary</span>
<span class="nb">}</span>

<span class="nb">setup_interface_&lt;protocolname&gt;</span><span class="o">()</span><span class="nb"> {</span>
<span class="nb">    local interface</span><span class="o">=</span><span class="nb">&quot;</span><span class="s">$</span>1&quot;
    local config=&quot;<span class="s">$</span><span class="m">2</span><span class="nb">&quot;</span>
<span class="nb">    # set up the interface</span>
<span class="nb">}</span>
<span class="nv">\end</span><span class="nb">{Verbatim}</span>

<span class="nv">\texttt</span><span class="nb">{scan</span><span class="nv">\_\textit</span><span class="nb">{protocolname}} is optional and only necessary if your protocol</span>
<span class="nb">uses a custom device, e.g. a tunnel or a PPP device.</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2025-01-15 20:33:44 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
