Files
wlan-ap/feeds/ucentral/udhcpinject/src/udhcpinject.h
alex18_huang c5793bae3a udhcpinject: Allow option 82 DHCP fields to be transparently injected into client DHCP requests
1. Added userspace application udhcpinject to inject DHCP option 82 transparently
2. Added README.md for example usage

Fixes: WIFI-14018
Signed-off-by: alex18_huang <alex18_huang@accton.com>
2025-04-10 07:56:13 +02:00

47 lines
887 B
C

#include <stdint.h>
#include <netinet/in.h>
#define LEN_ESSID 32
#define LEN_BSSID 12
#define LEN_IFACE 15
// DHCP header structure
struct dhcp_packet {
uint8_t op;
uint8_t htype;
uint8_t hlen;
uint8_t hops;
uint32_t xid;
uint16_t secs;
uint16_t flags;
struct in_addr ciaddr;
struct in_addr yiaddr;
struct in_addr siaddr;
struct in_addr giaddr;
uint8_t chaddr[16];
char sname[64];
char file[128];
uint32_t magic;
uint8_t options[];
};
// Structure to hold interface info
struct iface_info {
char iface[LEN_IFACE + 1];
char essid[LEN_ESSID + 1];
char bssid[LEN_BSSID + 1];
int serial;
};
struct port_info {
char name[LEN_IFACE + 1];
int sock;
int ifindex;
};
// VLAN header structure
struct vlan_hdr {
__be16 h_vlan_TCI; // VLAN Tag Control Information
__be16 h_vlan_encapsulated_proto; // Encapsulated protocol
};