# rsvp — IP Protocol 46 MPLS RSVP-TE Path & Resv LSP Signaling (`rsvp`)

> **FrameAssembly v3.3.0** · Protocol 43 of 81 · Canonical URL: https://frameassembly-lang.dev/docs/protocols/rsvp

- **Full Protocol Name:** Resource Reservation Protocol — Traffic Engineering
- **Keyword:** `rsvp`
- **OSI Layer & Transport:** Layer 3 · IP Proto 46 (Router Alert Optional)
- **Host Endpoint Rule:** Dual-Stack IPv4/IPv6
- **Standards:** RFC 2205, RFC 3209, RFC 4090
- **Wireshark Display Filter:** `rsvp`
- **Wire Encapsulation:** `Ethernet II -> [802.1Q / QinQ / MPLS] -> IPv4 / IPv6 -> RSVP-TE (RFC 3209) (IP Proto 46 (Router Alert Optional))`

## Overview

Signal bandwidth-guaranteed MPLS-TE tunnels on IP Protocol `46`: pair `rsvp path` + `routeralert` downstream with `rsvp resv label 24010` upstream and watch Wireshark dissect every Class-Num object.

Resource Reservation Protocol — Traffic Engineering (`rsvp`, **IP Protocol `46`**, RFC 2205 / RFC 3209) signals bandwidth-guaranteed **MPLS Traffic Engineering Label Switched Paths (TE-LSPs)** and RFC 4090 Fast Reroute (FRR) bypass tunnels across carrier and financial WAN backbones. Headend routers transmit downstream `Path` messages carrying `LSP_TUNNEL_IPV4/IPV6` `SESSION`, `RSVP_HOP`, `TIME_VALUES`, `LABEL_REQUEST`, and `SENDER_TEMPLATE` objects, and tailend/transit LSRs reply upstream with `Resv` messages carrying allocated `LABEL` objects.

FrameAssembly encodes the 8-byte RFC 2205 common header (Version `1`, Message Type, ones'-complement RSVP checksum, Send_TTL, Total Length) plus properly aligned 4-byte RSVP Object headers (`Length`, `Class-Num`, `C-Type`), and pairs seamlessly with the `routeralert` IPv4 modifier (`IP Option 20`).

## Minimal Quickstart (`rsvp_quickstart.frasm`)

```frameassembly
host pe_headend { ip 172.16.0.1 }
host pe_tailend { ip 172.16.0.2 }

compile {
    pe_headend -> pe_tailend rsvp path tunnelid 100 lspid 1 srcip 172.16.0.1 dstip 172.16.0.2 routeralert wait 2ms
    pe_headend <- pe_tailend rsvp resv tunnelid 100 lspid 1 label 24100
}
```

### Automatic Wire Calculations

- Sets outer IPv4 Protocol / IPv6 Next Header to `46` (`RSVP`) and computes the 16-bit ones'-complement RSVP message checksum over all appended Class-Num / C-Type objects.
- Builds RFC 3209 `SESSION` (Class `1`, C-Type `7` IPv4 / `8` IPv6 LSP_TUNNEL), `RSVP_HOP` (`3`), `TIME_VALUES` (`5`), `LABEL_REQUEST` (`19`) on `path`, `LABEL` (`16`) on `resv`, `ERROR_SPEC` (`6`) on `patherr`/`resverr`, and `HELLO` (`22`) on `hello`.
- Combines cleanly with `routeralert` on IPv4 endpoints to insert the 4-byte RFC 2113 Router Alert IP option (`0x94 0x04 0x00 0x00`) expected by transit LSRs.

## Practical Lab Example: MPLS-TE Tunnel Lifecycle: RSVP Hello, Path/Resv Setup, MPLS Data & Make-Before-Break Re-Opt (`rsvp_te_lifecycle.frasm`)

Walks through LSR neighbor `hello`, `lspid 1` signaling (`label 24010`), labeled traffic forwarding, make-before-break `lspid 2` (`label 24020`) re-optimization, and graceful `pathtear` of `lspid 1`.

```frameassembly
host headend_pe { ip 10.0.12.1 mac 00:1c:73:01:00:01 }
host tailend_pe { ip 10.0.12.2 mac 00:1c:73:02:00:02 }

compile {
    // 1. RSVP Node Hello adjacency check
    headend_pe -> tailend_pe rsvp hello srcip 10.0.12.1 dstip 10.0.12.2 wait 1ms
    // 2. Signal Tunnel 500, LSP 1 with IPv4 Router Alert -> Tailend allocates Label 24010
    headend_pe -> tailend_pe rsvp path tunnelid 500 lspid 1 refresh 30000 srcip 10.0.12.1 dstip 10.0.12.2 routeralert wait 2ms
    headend_pe <- tailend_pe rsvp resv tunnelid 500 lspid 1 label 24010 refresh 30000 srcip 10.0.12.1 dstip 10.0.12.2 wait 2ms
    // 3. Forward traffic over allocated TE Label 24010
    headend_pe -> tailend_pe icmp echorequest id 50 seq 1 mpls 24010 exp 5 wait 2ms
    // 4. Make-before-break LSP 2 (Label 24020), then tear down old LSP 1
    headend_pe -> tailend_pe rsvp path tunnelid 500 lspid 2 srcip 10.0.12.1 dstip 10.0.12.2 routeralert wait 1ms
    headend_pe <- tailend_pe rsvp resv tunnelid 500 lspid 2 label 24020 srcip 10.0.12.1 dstip 10.0.12.2 wait 1ms
    headend_pe -> tailend_pe rsvp pathtear tunnelid 500 lspid 1 srcip 10.0.12.1 dstip 10.0.12.2 routeralert
}
```

```bash
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show rsvp_te_lifecycle.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly rsvp_te_lifecycle.frasm rsvp_te_lifecycle.pcap
frameassembly rsvp_te_lifecycle.frasm rsvp_te_lifecycle.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse rsvp_te_lifecycle.pcap rsvp_te_lifecycle_edited.frasm

# 4. Verify dissected protocol fields in tshark
tshark -r rsvp_te_lifecycle.pcap
```

## All `rsvp` Keywords & Header Options

Packet line pattern: `src_host -> dst_host rsvp [path | resv | patherr | resverr | pathtear | resvtear | resvconf | hello] [tunnelid <0..65535>] [lspid <0..65535>] [label <number>] [refresh <number>] [srcip <ip>] [dstip <ip>] [errcode <0..255>]`

| Keyword / Option | Accepted Value | Default | Effect on Packet |
| --- | --- | --- | --- |
| `path \| resv \| patherr \| resverr \| pathtear \| resvtear \| resvconf \| hello` | RSVP-TE message type keyword | `path (Type 1)` | Selects RSVP Message Type (`1`=Path, `2`=Resv, `3`=PathErr, `4`=ResvErr, `5`=PathTear, `6`=ResvTear, `7`=ResvConf, `20`=Hello). |
| `tunnelid <0..65535> \| lspid <0..65535>` | 16-bit TE Tunnel ID and 16-bit LSP ID | `tunnelid 1, lspid 1` | Populates the RFC 3209 `SESSION` Tunnel ID and `SENDER_TEMPLATE` / `FILTER_SPEC` LSP ID. |
| `label <0..1048575>` | MPLS label value in Resv LABEL object | `16` | Encodes the downstream-assigned MPLS label inside the Class `16` `RSVP LABEL` object on `resv` messages. |
| `refresh <number>` | 32-bit refresh period R in milliseconds | `30000 (30s)` | Sets the refresh interval inside the `TIME_VALUES` object (`Class 5`). |
| `srcip <ip> \| dstip <ip>` | Tunnel sender and endpoint IPv4/IPv6 addresses | `Outer frame source and destination host IPs` | Populates the tunnel headend (`SENDER_TEMPLATE`) and tailend (`SESSION` Endpoint) addresses. |
| `errcode <0..255>` | 8-bit RSVP Error Code | `24 (Routing Problem)` | Sets the Error Code inside `ERROR_SPEC` (`Class 6`) on `patherr` and `resverr` frames. |

## Cross-Layer Options Valid with `rsvp`

| Option | Range / Format | Default | Effect |
| --- | --- | --- | --- |
| `wait <number><ns\|us\|ms\|s\|m>` | Time gap (ns, us, ms, s, m) | `10ms` | Advances the packet timestamp clock after sending this packet and before the next packet (`wait 0ns` sends back-to-back). |
| `comment "<text>"` | Quoted UTF-8 annotation | `Omitted` | Attaches an Enhanced Packet Block `opt_comment` annotation when compiling to `.pcapng` (Wireshark `pkt_comment` filter). |
| `payload "<text>" \| hexpayload "<hex>"` | Quoted text or hex bytes (choose one) | `Omitted` | Appends or overrides raw payload bytes (`"deadbeef"`, `"de:ad:be:ef"`, or `"\x01\x02"`) and updates packet lengths and checksums. |
| `srcmac <mac> \| dstmac <mac> \| ethertype <0..65535>` | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | `Host MAC / RFC multicast MAC / auto EtherType` | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| `fcs \| badfcs` | Ethernet CRC-32 trailer flags (choose one) | `Omitted` | `fcs` appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; `badfcs` XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| `vlan <0..4095> [pcp <0..7>] [dei <0\|1>]` | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | `Untagged` | Wraps the packet in an IEEE 802.1Q VLAN tag (`0x8100`) with optional 802.1p QoS priority. |
| `qinq <0..4095> [innervlan <0..4095>]` | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | `Untagged (innervlan 1 when qinq is set)` | Double-tags the packet with outer IEEE 802.1ad S-Tag (`0x88a8`) plus inner IEEE 802.1Q C-Tag (`0x8100`). |
| `mpls <0..1048575> [label <0..1048575>] [exp\|tc <0..7>] [bos <0\|1>] [mplsttl <0..255>]` | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | `Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)` | Prepends one or more 32-bit MPLS label shims (`0x8847`, e.g. `mpls 16000 mpls 24010`) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
| `ttl <0..255> [dscp <0..63>] [ecn <0..3>]` | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | `ttl 64, dscp 0, ecn 0` | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| `ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum]` | IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum fault | `ipid 1, flags 0, fragoffset 0, valid RFC 1071 checksum` | Sets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (`20 04 00 00`), or corrupts the 16-bit IPv4 header checksum (`badipchecksum`). |
| `flowlabel <0..1048575>` | 20-bit IPv6 Flow Label (0..1048575) | `0` | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only). |

## Common Mistakes & Quick Fixes

### RSVP Runs Directly on IP Protocol 46 (Never TCP or UDP)

- **Avoid:** `pe1 -> pe2 rsvp path tunnelid 10 dstport 3455`
- **Valid v3.3.0 Syntax:** `pe1 -> pe2 rsvp path tunnelid 10 routeralert`

Standard RFC 2205 / RFC 3209 RSVP is a native Layer 3 IP protocol (`46`), so TCP/UDP ports and `transport` overrides are rejected.

### Attach routeralert When Simulating Hop-by-Hop IPv4 Path Inspection

- **Avoid:** `Forgetting Router Alert when testing transit LSR punt rules`
- **Valid v3.3.0 Syntax:** `pe1 -> pe2 rsvp path tunnelid 10 lspid 1 routeralert`

Adding the cross-layer `routeralert` flag injects IPv4 Option `20` (`0x94 0x04 0x00 0x00`), matching how production Juniper and Cisco routers punt `Path` and `PathTear` messages.
