C.7. Sending the VRRP Advertisement

 /********************************************************* NAME : vrrp_send_pkt *********************************************************/ static int vrrp_send_pkt( vrrp_rt *vsrv, char *buffer, int buflen ) { struct sockaddr from; int len; int fd = socket(PF_PACKET, SOCK_PACKET, 0x300); /* 0x300 is magic */ if( fd < 0 ){ perror( "socket" ); return -1; } /* build the address */ memset( &from, 0 , sizeof(from)); strcpy( from.sa_data, vsrv->vif.ifname ); /* send the data */ len = sendto( fd, buffer, buflen, 0, &from, sizeof(from) ); close( fd ); return len; } /********************************************************* NAME : vrrp_send_adv *********************************************************/ static int vrrp_send_adv( ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.