# ssdp — Multicast UDP 1900 UPnP M-SEARCH & NOTIFY Frames (`ssdp`)

> **FrameAssembly v3.2.2** · Protocol 61 of 81 · Canonical URL: https://frameassembly-lang.dev/docs/protocols/ssdp

- **Full Protocol Name:** Simple Service Discovery Protocol & UPnP Multicast
- **Keyword:** `ssdp`
- **OSI Layer & Transport:** Layer 7 · UDP 1900 (239.255.255.250 / ff02::c)
- **Host Endpoint Rule:** Dual-Stack IPv4/IPv6
- **Standards:** UPnP Device Architecture 2.0
- **Wireshark Display Filter:** `ssdp`
- **Wire Encapsulation:** `Ethernet II -> [802.1Q / QinQ / MPLS] -> IPv4 / IPv6 -> UDP 1900 (239.255.255.250 / ff02::c) -> SSDP (UPnP)`

## Overview

HTTP headers stuffed into UDP `1900` multicast (`239.255.255.250`) — `ssdp` uses `hosthdr` for the `HOST:` header and catches unauthorized UPnP port-forwarding chatter on enterprise VLANs.

Simple Service Discovery Protocol (`ssdp`) powers UPnP plug-and-play device discovery across smart TVs, printers, media servers, and home/branch routers using HTTP-over-UDP (**HTTPU**) on **UDP port `1900`** (multicast `239.255.255.250` on IPv4 or `ff02::c` on IPv6).

Because exposed UDP `1900` responders are a classic DDoS reflection vector (`ST: ssdp:all`) and unauthorized UPnP `InternetGatewayDevice` port-forwarding is a frequent enterprise security finding, FrameAssembly lets you build both `msearch` discovery probes and `notify` presence announcements cleanly.

## Minimal Quickstart (`ssdp_quickstart.frasm`)

```frameassembly
host laptop    { ip 10.10.20.42 }
host ssdp_mcast { ip 239.255.255.250 }

compile {
    laptop -> ssdp_mcast ssdp msearch hosthdr "239.255.255.250:1900" mx 3 st "ssdp:all"
}
```

### Automatic Wire Calculations

- Defaults UDP destination port to `1900` and automatically derives the RFC 1112 multicast MAC `01:00:5e:7f:ff:fa` when sending to `239.255.255.250`.
- Formats `M-SEARCH * HTTP/1.1
` with `HOST`, `MAN: "ssdp:discover"`, `MX`, and `ST` headers on `msearch` packets.
- Formats `NOTIFY * HTTP/1.1
` with `HOST`, `NT`, `NTS` (default `"ssdp:alive"`), `USN`, and `LOCATION` headers on `notify` packets.

## Practical Lab Example: IoT Gateway SSDP M-SEARCH Sweep & UPnP IGD Alive Notification (`ssdp_upnp_audit.frasm`)

Sends a multicast `msearch` looking for UPnP Internet Gateway Devices, followed by a router `notify` advertisement pointing to its XML description URL.

```frameassembly
host scanner   { ip 192.168.10.55 }
host upnp_grp  { ip 239.255.255.250 }
host rogue_rtr { ip 192.168.10.254 }

compile {
    scanner -> upnp_grp ssdp msearch hosthdr "239.255.255.250:1900" man "\"ssdp:discover\"" mx 2 st "urn:schemas-upnp-org:device:InternetGatewayDevice:1" wait 5ms
    rogue_rtr -> upnp_grp ssdp notify hosthdr "239.255.255.250:1900" nt "urn:schemas-upnp-org:device:InternetGatewayDevice:1" nts "ssdp:alive" usn "uuid:f81d4fae-7dec::upnp:rootdevice" location "http://192.168.10.254:49152/rootDesc.xml"
}
```

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

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly ssdp_upnp_audit.frasm ssdp_upnp_audit.pcap
frameassembly ssdp_upnp_audit.frasm ssdp_upnp_audit.pcapng

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

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

## All `ssdp` Keywords & Header Options

Packet line pattern: `src_host -> dst_host ssdp [msearch | notify] [hosthdr "<text>"] [man "<text>"] [mx <0..255>] [st "<text>"] [nt "<text>"] [nts "<text>"] [usn "<text>"] [location "<text>"]`

| Keyword / Option | Accepted Value | Default | Effect on Packet |
| --- | --- | --- | --- |
| `msearch \| notify` | SSDP HTTPU method | `msearch` | Selects `M-SEARCH * HTTP/1.1` active discovery or `NOTIFY * HTTP/1.1` multicast announcement. |
| `hosthdr "<text>"` | Quoted `HOST:` header value | `"239.255.255.250:1900"` | Sets the `HOST:` header (named `hosthdr` to avoid clashing with top-level `host` blocks). |
| `man "<text>" \| mx <0..255> \| st "<text>"` | M-SEARCH discovery headers (`MX` max wait seconds, `ST` Search Target) | `man "\"ssdp:discover\"", mx 3, st "ssdp:all"` | Populates mandatory UPnP discovery request headers on `msearch` packets. |
| `nt "<text>" \| nts "<text>" \| usn "<text>" \| location "<text>"` | NOTIFY advertisement headers (`NTS` `"ssdp:alive"` or `"ssdp:byebye"`) | `nts "ssdp:alive"` | Populates Notification Type, Sub-Type, Unique Service Name, and XML `LOCATION` URL on `notify` packets. |

## Cross-Layer Options Valid with `ssdp`

| 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). |
| `payload "<text>" \| hexpayload "<hex>"` | Quoted text or hex bytes (choose one) | `Omitted` | Appends or overrides raw payload bytes (`"deadbeef"` or `"de:ad:be:ef"`) and updates packet lengths and checksums. |
| `srcmac <mac> \| dstmac <mac> \| ethertype <0..65535>` | Colon/hyphen/Cisco MAC · EtherType u16 (e.g. 0x0800) | `Host MAC / RFC multicast MAC / auto EtherType` | Overrides the 14-byte Ethernet II source MAC, destination MAC, or 16-bit EtherType for this single packet. |
| `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>]` | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | `Unlabeled (at most 1 mpls tag per packet)` | Inserts a 32-bit MPLS label header (`0x8847`) ahead of the Layer 3 header. |
| `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>]` | IPv4 ID, DF/MF flags, fragment offset 0..8191 | `ipid 1, flags 0, fragoffset 0` | Sets IPv4 Identification, Do-Not-Fragment (`df`), More-Fragments (`mf`), and fragment offset (ignored over IPv6). |
| `flowlabel <0..1048575>` | 20-bit IPv6 Flow Label (0..1048575) | `0` | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| `srcport <0..65535> \| dstport <0..65535>` | Port number 0..65535 | `srcport 49152 (remembered), UDP 1900 (239.255.255.250 / ff02::c)` | Overrides source or destination port and remembers the port pair automatically on `<-` replies. |

## Common Mistakes & Quick Fixes

### Use msearch (No Hyphen) and hosthdr (Not host)

- **Avoid:** `laptop -> ssdp_mcast ssdp m-search host "239.255.255.250:1900"`
- **Valid v3.2.2 Syntax:** `laptop -> ssdp_mcast ssdp msearch hosthdr "239.255.255.250:1900"`

Spell `msearch` without a hyphen and use `hosthdr` for the `HOST:` header.
