Exemplo n.º 1
0
bool
ipv4_multicast_leave( struct in_addr addr ) {
  assert( vxlan != NULL );

  if ( !IN_MULTICAST( ntohl( addr.s_addr ) ) ) {
    return false;
  }

  update_interface_state();
  if ( !vxlan->active ) {
    return false;
  }

  return set_ipv4_multicast_leave( vxlan->udp_sock, addr, vxlan->ifname );
}
Exemplo n.º 2
0
DWORD WINAPI eap_thread()
{
    extern pcap_t *handle;
    extern char    devname[];
    
    init_device();
    init_frames ();
    send_eap_packet (EAPOL_START);
    pcap_loop (handle, -1, get_packet, NULL);   /* main loop */
    pcap_close (handle);

    memset (devname, 0, MAX_DEV_NAME_LEN);
    update_interface_state(NULL);
    return 0;
}
Exemplo n.º 3
0
bool
init_net( struct vxlan *_vxlan ) {
  assert( _vxlan != NULL );

  vxlan = _vxlan;

  vxlan->udp_sock = socket( AF_INET, SOCK_DGRAM, 0 );
  if ( vxlan->udp_sock < 0 ) {
    char buf[ 256 ];
    char *error_string = safe_strerror_r( errno, buf, sizeof( buf ) );
    error( "Failed to create a socket for IPv4 ( ret = %d, errno = %s [%d] ).",
           vxlan->udp_sock, error_string, errno );
    goto error;
  }

  bool ret = bind_ipv4_inaddrany( vxlan->udp_sock, vxlan->port );
  if ( !ret ) {
    goto error;
  }
  ret = set_ipv4_multicast_loop( vxlan->udp_sock, 0 );
  if ( !ret ) {
    goto error;
  }
  ret = set_ipv4_multicast_ttl( vxlan->udp_sock, VXLAN_MCAST_TTL );
  if ( !ret ) {
    goto error;
  }

  ret = update_interface_state();
  if ( !ret ) {
    goto error;
  }

  ret = init_multicast_group_table();
  if ( !ret ) {
    goto error;
  }

  return true;

error:
  if ( vxlan->udp_sock >= 0 ) {
    close( vxlan->udp_sock );
  }

  return false;
}
Exemplo n.º 4
0
void thread_error_exit(const char *errmsg) 
{
    MessageBox (hwndDlg, errmsg, NULL, MB_OK);
    update_interface_state (NULL);
    ExitThread(0);
}