From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KdQAR-0006I0-A5 for qemu-devel@nongnu.org; Wed, 10 Sep 2008 09:55:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KdQAP-0006Fw-Ju for qemu-devel@nongnu.org; Wed, 10 Sep 2008 09:55:34 -0400 Received: from [199.232.76.173] (port=41772 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdQAP-0006Fh-4c for qemu-devel@nongnu.org; Wed, 10 Sep 2008 09:55:33 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:40118) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KdQAO-0001ls-U3 for qemu-devel@nongnu.org; Wed, 10 Sep 2008 09:55:33 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m8ADtKph026142 for ; Wed, 10 Sep 2008 09:55:20 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m8ADtGxV232236 for ; Wed, 10 Sep 2008 09:55:16 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8ADtGLI016680 for ; Wed, 10 Sep 2008 09:55:16 -0400 Message-ID: <48C7D193.8070309@us.ibm.com> Date: Wed, 10 Sep 2008 08:54:27 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 5/10] Add network announce function References: <1220989802-13706-1-git-send-email-aliguori@us.ibm.com> <1220989802-13706-6-git-send-email-aliguori@us.ibm.com> <48C7CB28.2090707@redhat.com> In-Reply-To: <48C7CB28.2090707@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chris Lalancette Cc: Chris Wright , Uri Lublin , qemu-devel@nongnu.org, kvm@vger.kernel.org Chris Lalancette wrote: > 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? > I didn't write this code originally. Perhaps Uri or Avi know who did and can provide some insight? Regards, Anthony Liguori > Chris Lalancette > >