Exemple #1
0
void
process_fdb_etherflame_from_vxlan (struct vxlan_instance * vins,
                                   struct ether_header * ether, 
                                   struct sockaddr_storage * vtep_addr)
{
        struct fdb_entry * entry;

        entry = fdb_search_entry (vins->fdb, (u_int8_t *) ether->ether_shost);

        if (entry == NULL) {
		EXTRACT_PORT (*vtep_addr) = htons (VXLAN_PORT_BASE);
                fdb_add_entry (vins->fdb, (u_int8_t *) ether->ether_shost, *vtep_addr);

#ifdef LOGGING_FDB_CHANGE
                syslog (LOG_INFO, "add entry %02x:%02x:%02x:%02x:%02x:%02x",
                        ether->ether_shost[0], ether->ether_shost[1],
                        ether->ether_shost[2], ether->ether_shost[3],
                        ether->ether_shost[4], ether->ether_shost[5]);
		
		syslog (LOG_INFO, "Add, Number of FDB entry is %d",
			vins->fdb->fdb.count);
#endif
        }
        else {
                if (MEMCMP_SOCKADDR (*vtep_addr, entry->vtep_addr) == 0) {
                        entry->ttl = vins->fdb->fdb_max_ttl;
                } else {
                        entry->vtep_addr = * vtep_addr;
                        entry->ttl = vins->fdb->fdb_max_ttl;
                }
        }

        return;
}
Exemple #2
0
void
process_fdb_etherflame_from_vxlan (struct ether_header * ether, struct in_addr * vtep_addr)
{
    struct fdb_entry * entry;
    struct sockaddr_in * saddr_in;

    entry = fdb_search_entry (&vxlan.fdb, (u_int8_t *) ether->ether_shost);
    if (entry == NULL)
        fdb_add_entry (&vxlan.fdb, (u_int8_t *) ether->ether_shost, *vtep_addr);
    else {
        saddr_in = (struct sockaddr_in *) &entry->vtep_addr;
        if (saddr_in->sin_addr.s_addr != vtep_addr->s_addr) {
            saddr_in->sin_addr = *vtep_addr;
        }
        entry->ttl = FDB_CACHE_TTL;
    }

    return;
}