Revision: 465 http://vde.svn.sourceforge.net/vde/?rev=465&view=rev Author: rd235 Date: 2011-01-28 10:50:57 +0000 (Fri, 28 Jan 2011)
Log Message: ----------- Multiple tap/grab support for kvde_switch Modified Paths: -------------- trunk/vde-2/src/kvde_switch/datasock.c Modified: trunk/vde-2/src/kvde_switch/datasock.c =================================================================== --- trunk/vde-2/src/kvde_switch/datasock.c 2011-01-26 16:59:50 UTC (rev 464) +++ trunk/vde-2/src/kvde_switch/datasock.c 2011-01-28 10:50:57 UTC (rev 465) @@ -105,12 +105,13 @@ } } -static void runextinterfaces(int kvdefd) +static void runextinterfaces(struct sockaddr_un *sun) { struct extinterface *iface,*oldiface; struct ifreq ifr; for (iface=extifhead;iface != NULL;iface=oldiface) { + int kvdefd; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name,iface->name,IFNAMSIZ); if (iface->type == 't') @@ -118,6 +119,18 @@ else ifr.ifr_flags=IPN_NODEFLAG_GRAB; // printf("ioctl\n"); + kvdefd = socket(AF_IPN,SOCK_RAW,IPN_VDESWITCH); + if (kvdefd < 0) { + kvdefd = socket(AF_IPN_STOLEN,SOCK_RAW,IPN_VDESWITCH); + if (kvdefd < 0) { + printlog(LOG_ERR,"kvde_switch grab/tap error socket"); + exit(-1); + } + } + if(bind(kvdefd, (struct sockaddr *) sun, sizeof(*sun)) < 0) { + printlog(LOG_ERR,"cannot bind socket grab/tap"); + exit(-1); + } if (ioctl(kvdefd, IPN_CONN_NETDEV, (void *) &ifr) < 0) { printlog(LOG_ERR, "%s interface %s error: %s", iface->name, (iface->type == 't')?"tap":"grab",strerror(errno)); @@ -201,7 +214,7 @@ printlog(LOG_ERR, "chown: %s", strerror(errno)); exit(1); } - runextinterfaces(kvdefd); + runextinterfaces(&sun); add_fd(kvdefd,ctl_type,-1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ vde-users mailing list vde-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vde-users