--- qemu/vl.c 2007-01-23 10:37:50.000000000 +0200 +++ qemu-new/vl.c 2007-01-23 10:26:49.000000000 +0200 @@ -51,6 +51,7 @@ #ifndef __sun__ #include #include +#include #include #include #include @@ -3940,6 +3941,50 @@ } } +#if defined(__linux__) +#define SELF_ANNOUNCE_ROUNDS 5 +#define ETH_P_EXPERIMENTAL 0x01F1 /* just a number in experimental range */ +#define EXPERIMENTAL_MAGIC 0xf1f23f4f +int announce_self_create(unsigned char *buf, + unsigned char mac_addr[ETH_ALEN]) +{ + struct ethhdr *eh = (struct ethhdr*)buf; + uint32_t *magic = (uint32_t*)(eh+1); + unsigned char *p = (unsigned char*)(magic + 1); + + /* ethernet header */ + memset(eh->h_dest, 0xff, ETH_ALEN); + memcpy(eh->h_source, mac_addr, ETH_ALEN); + eh->h_proto = htons(ETH_P_EXPERIMENTAL); + + /* magic data */ + *magic = EXPERIMENTAL_MAGIC; + + return p - buf; /* sizeof(*eh) + sizeof(*magic) */ +} + +void qemu_tap_announce_self(void) +{ + int i, j, len; + VLANState *vlan; + VLANClientState *vc; + uint8_t buf[256]; + + for (i=0; ifirst_client; vc != NULL; vc = vc->next) { + if (vc->fd_read == tap_receive) { /* send only if tap */ + for (j=0; jfd_read(vc->opaque, buf, len); + } + } + } /* for vc -- look for tap_receive */ + } /* for i -- all nics */ +} +#else +void qemu_tap_announce_self(void) {} +#endif /***********************************************************/ /* USB devices */ @@ -7480,6 +7525,9 @@ printf("Migration failed\n"); exit(1); } + else { + qemu_tap_announce_self(); + } } {