Files
wlan-ap/feeds/ucentral/udhcpinject
alex18_huang 1f0a24a941 udhcpinject: Multiple ssids sometime didn't display dhcp option 82 rules
Added check when parsing ssid info retrieved from iwinfo.
Program will exit if expected interface count and iwinfo entry count mismatch.

Fixes: WIFI-14564
Signed-off-by: alex18_huang <alex18_huang@accton.com>
2025-04-28 12:33:00 +02:00
..

DHCP Option82 injector

inject DHCP option 82 transparently on TIP AP

Format

Option 82: (82) Agent Information
    Option: (1) Agent Circuit ID
        Agent Circuit ID: BSSID:ESSID
    Option: (2) Agent Remote ID
        Agent Remote ID: AP Hostname

Usage

add "dhcpinject" under ssid->services

{
    "interfaces": [
        {
            "ethernet": [
                {
                    "select-ports": [
                        "WAN*"
                    ]
                }
            ],
            "ipv4": {
                "addressing": "dynamic"
            },
            "name": "WAN",
            "role": "upstream",
            "services": [
                "ssh",
                "lldp",
                "dhcp-snooping",
                "http"
            ],
            "ssids": [
                {
                    "bss-mode": "ap",
                    "encryption": {
                        "ieee80211w": "optional",
                        "key": "ERC981206",
                        "proto": "psk2"
                    },
                    "name": "EAP101-ERICHI",
                    "services": [
                        "wifi-frames",
                        "dhcpinject"     <-- devices connected to this ssid will trigger this application
                    ],
                    "wifi-bands": [
                        "2G",
                        "5G"
                    ]
                },
                {
                    "bss-mode": "ap",
                    "encryption": {
                        "ieee80211w": "optional",
                        "key": "AKH981016",
                        "proto": "psk2"
                    },
                    "name": "EAP101-AKIHO",
                    "services": [
                        "wifi-frames", <-- devices connected to this ssid will NOT trigger this application
                    ],
                    "wifi-bands": [
                        "2G",
                        "5G"
                    ]
                },
                {
                    "bss-mode": "ap",
                    "encryption": {
                        "ieee80211w": "optional",
                        "key": "DMY971128",
                        "proto": "psk2"
                    },
                    "name": "EAP101-DAMAYU",
                    "services": [
                        "wifi-frames",
                        "dhcpinject" <-- devices connected to this ssid will trigger this application
                    ],
                    "wifi-bands": [
                        "2G"
                    ]
                }
            ]
        }
    ],
    "services": {
        "dhcp-inject": {
            "select-ports": [
                "WAN*" <-- Will fallback to eth0 if no ports are provided
            ]
        }
    }
}

Workflow

Suppose SSID EAP101-ERICHI binds to iface wlan0

  • Application read SSIDs and uplink ports from env variable $SSIDs and $PORTs (generated by script /etc/init.d/udhcpinject)
  • Apply tc on wlan0 to redirect DHCP Discover/Request to iface ifb-inject
  • Application listen on interface ifb-inject for incoming DHCP packets
  • On packets arrive, application identify the src interface by vlan tag and insert corresponding attribute
  • Forward packet to up0v0