[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/10] Add network announce function
From: |
Chris Lalancette |
Subject: |
Re: [Qemu-devel] [PATCH 5/10] Add network announce function |
Date: |
Wed, 10 Sep 2008 15:27:04 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080723) |
Anthony Liguori wrote:
> +static int announce_self_create(uint8_t *buf,
> + uint8_t *mac_addr)
> +{
> + uint32_t magic = EXPERIMENTAL_MAGIC;
> + uint16_t proto = htons(ETH_P_EXPERIMENTAL);
> +
> + /* FIXME: should we send a different packet (arp/rarp/ping)? */
> +
> + memset(buf, 0xff, 6); /* h_dst */
> + memcpy(buf + 6, mac_addr, 6); /* h_src */
> + memcpy(buf + 12, &proto, 2); /* h_proto */
> + memcpy(buf + 14, &magic, 4); /* magic */
> +
> + return 18; /* len */
> +}
> +
> +void qemu_announce_self(void)
> +{
> + int i, j, len;
> + VLANState *vlan;
> + VLANClientState *vc;
> + uint8_t buf[256];
> +
> + for (i = 0; i < nb_nics; i++) {
> + len = announce_self_create(buf, nd_table[i].macaddr);
> + vlan = nd_table[i].vlan;
> + for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
> + if (vc->fd_read == tap_receive) /* send only if tap */
> + for (j=0; j < SELF_ANNOUNCE_ROUNDS; j++)
> + vc->fd_read(vc->opaque, buf, len);
> + }
> + }
> +}
> +
This one is yucky, as the FIXME points out. First, I'm guessing the point of
this is to do an ARP poison on the switch? If so, we probably want to do some
kind of ARP packet, although I'm not an expert on this. Also, why are we trying
SELF_ANNOUNCE_ROUNDS times? Is there some issue where some of these get
dropped, or is it just being safe about it?
Chris Lalancette
- Re: [Qemu-devel] [PATCH 2/10] Allow the monitor to be suspended during non-blocking op, (continued)
- [Qemu-devel] [PATCH 10/10] TCP based live migration, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 8/10] Introduce a buffered QEMUFile wrapper, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 9/10] Introduce the UI components for live migration, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 6/10] Introduce v3 of savevm protocol, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 5/10] Add network announce function, Anthony Liguori, 2008/09/09
- Re: [Qemu-devel] [PATCH 5/10] Add network announce function,
Chris Lalancette <=
- [Qemu-devel] [PATCH 4/10] Add dirty tracking for live migration, Anthony Liguori, 2008/09/09
- [Qemu-devel] [PATCH 7/10] Switch the memory savevm handler to be "live", Anthony Liguori, 2008/09/09