C.6. Building a Valid Data Packet to be Sent over Ethernet

 /********************************************************* NAME : vrrp_build_dlt *********************************************************/ static void vrrp_build_dlt( vrrp_rt *vsrv, char *buffer, int buflen ) { /* hardcoded for ethernet */ struct ether_header * eth = (struct ether_header *)buffer; /* destination address —rfc1122.6.4*/ eth->ether_dhost[0] = 0x01; eth->ether_dhost[1] = 0x00; eth->ether_dhost[2] = 0x5E; eth->ether_dhost[3] = (INADDR_VRRP_GROUP >> 16) & 0x7F; eth->ether_dhost[4] = (INADDR_VRRP_GROUP >> 8) & 0xFF; eth->ether_dhost[5] = INADDR_VRRP_GROUP & 0xFF; /* source address —rfc2338.7.3 */ memcpy( eth->ether_shost, vrrp_hwaddr, sizeof(vrrp_hwaddr)); /* type */ eth->ether_type ...

Get VRRP: Increasing Reliability and Failover with the Virtual Router Redundance Protocol now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.