# What is the standard\_metadata.egress\_spec?

**URL:** <https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489>\
**Category:** Getting Started with P4\
**Created:** [October 9, 2022, 2:41pm UTC](https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489 "2022-10-09T14:41:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeMur](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@DeMur](https://forum.p4.org/u/DeMur)\
**Post date:** [October 9, 2022, 2:41pm UTC](https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489/1 "2022-10-09T14:41:14Z")

</div>

Hello everyone,

could someone explain to me what is standard\_metadata.egress\_spec that is used here? In the Basic exercise from GitHub ([tutorials/exercises/basic at master · p4lang/tutorials · GitHub](https://github.com/p4lang/tutorials/blob/master/exercises/basic)) the ipv4\_forward action is use this variable but it doesn’t mention anywhere else in the file except the JSON runtime files.

```auto
  action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {
        standard_metadata.egress_spec = port;
        hdr.ethernet.srcAddr = hdr.ethernet.dstAddr;
        hdr.ethernet.dstAddr = dstAddr;
        hdr.ipv4.ttl = hdr.ipv4.ttl - 1;
    }

```

Also, I found a project that uses the standard\_metadata.instance\_type. What is this used for?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [October 10, 2022, 12:45am UTC](https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489/2 "2022-10-10T00:45:34Z")

</div>

Please read this documentation, which hopefully answers your questions. If you have any further questions, please reply here to follow up: [behavioral-model/simple\_switch.md at main · p4lang/behavioral-model · GitHub](https://github.com/p4lang/behavioral-model/blob/main/docs/simple_switch.md)
