<h3>Contribution description</h3>
<p>To simulate gcoap on a 802.15.4 node we can use the <code>socket_zep</code> network interface for <code>native</code>.<br>
This adds a convenient make variable to enable this with a single command line option.</p>
<h3>Testing procedure</h3>
<ul>
<li>
<p>create tap interface</p>
<div class="snippet-clipboard-content position-relative"><pre><code> sudo dist/tools/tapsetup/tapsetup
</code></pre><div class="zeroclipboard-container position-absolute right-0 top-0">
  <clipboard-copy value=" sudo dist/tools/tapsetup/tapsetup
" aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w">
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-clippy js-clipboard-clippy-icon d-block m-2">
    <path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path>
</svg>
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-check js-clipboard-check-icon color-text-success d-block d-sm-none m-2">
    <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
  </clipboard-copy>
</div>
</div>
</li>
<li>
<p>start ZEP border router</p>
<div class="snippet-clipboard-content position-relative"><pre><code>make -C examples/gnrc_border_router BOARD=native all term
</code></pre><div class="zeroclipboard-container position-absolute right-0 top-0">
  <clipboard-copy value="make -C examples/gnrc_border_router BOARD=native all term
" aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w">
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-clippy js-clipboard-clippy-icon d-block m-2">
    <path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path>
</svg>
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-check js-clipboard-check-icon color-text-success d-block d-sm-none m-2">
    <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
  </clipboard-copy>
</div>
</div>
</li>
<li>
<p>run gcoap example with a simulated 802.15.4 interface with custom MAC address</p>
<div class="snippet-clipboard-content position-relative"><pre><code> make -C examples/gcoap BOARD=native USE_ZEP=1 ZEP_MAC=\"E6:CB:21:BF:9B:F8:72:62\" all term
</code></pre><div class="zeroclipboard-container position-absolute right-0 top-0">
  <clipboard-copy value=" make -C examples/gcoap BOARD=native USE_ZEP=1 ZEP_MAC=\"E6:CB:21:BF:9B:F8:72:62\" all term
" aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w">
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-clippy js-clipboard-clippy-icon d-block m-2">
    <path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path>
</svg>
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-check js-clipboard-check-icon color-text-success d-block d-sm-none m-2">
    <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
  </clipboard-copy>
</div>
</div>
</li>
</ul>
<div class="snippet-clipboard-content position-relative"><pre><code>main(): This is RIOT! (Version: 2021.07-devel-225-gc21097)
gcoap example app
All up, running the shell now
> ifconfig
ifconfig
Iface  7  HWaddr: 72:62  Channel: 26  NID: 0x23 
          Long HWaddr: E6:CB:21:BF:9B:F8:72:62 
          L2-PDU:102  MTU:1280  HL:64  6LO  
          IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::e4cb:21bf:9bf8:7262  scope: link  VAL
          inet6 addr: 2001:db8::e4cb:21bf:9bf8:7262  scope: global  VAL
          inet6 group: ff02::1
</code></pre><div class="zeroclipboard-container position-absolute right-0 top-0">
  <clipboard-copy value="main(): This is RIOT! (Version: 2021.07-devel-225-gc21097)
gcoap example app
All up, running the shell now
> ifconfig
ifconfig
Iface  7  HWaddr: 72:62  Channel: 26  NID: 0x23 
          Long HWaddr: E6:CB:21:BF:9B:F8:72:62 
          L2-PDU:102  MTU:1280  HL:64  6LO  
          IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::e4cb:21bf:9bf8:7262  scope: link  VAL
          inet6 addr: 2001:db8::e4cb:21bf:9bf8:7262  scope: global  VAL
          inet6 group: ff02::1
" aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w">
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-clippy js-clipboard-clippy-icon d-block m-2">
    <path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path>
</svg>
    <svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" height="16" width="16" class="octicon octicon-check js-clipboard-check-icon color-text-success d-block d-sm-none m-2">
    <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
  </clipboard-copy>
</div>
</div>
<h3>Issues/PRs references</h3>


<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16472'>https://github.com/RIOT-OS/RIOT/pull/16472</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>examples/gcoap: add support for socket ZEP</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16472/files#diff-5836f4a0c6259fbf8a683b5bbb0e1c1eeb7ae9c519d0867d4b6e1a896965ca82">examples/gcoap/Makefile</a>
    (15)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16472.patch'>https://github.com/RIOT-OS/RIOT/pull/16472.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16472.diff'>https://github.com/RIOT-OS/RIOT/pull/16472.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16472">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYB7U5XKPXRRCUWKXQTTNUMZFANCNFSM444MPRMQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYHZ7CWUWN4SUSB3DCTTNUMZFA5CNFSM444MPRM2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NJJKK3A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16472",
"url": "https://github.com/RIOT-OS/RIOT/pull/16472",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>