Ok julian, So I must write loadd with ng_ether for the moment and wait for ng_etf include in FreeBSD 4.x. I can modify my code after if ng_etf is available... Last question, when I write a packet on the lower hook, must I include a CRC32 field at the end of the ethernet packet ?
I create a little test program for connecting lower <-> upper, but doesn't seem to work, what is wrong ? #include <netgraph.h> #include <netgraph/ng_ether.h> #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <unistd.h> #include <fcntl.h> #define HOOKNAME "myhook" #define HOOKNAME2 "myhook2" int main(int argc, char **argv) { int csock, dsock; struct ngm_connect ngc; struct ngm_connect ngc2; int bytesread; char buf[4096]; char hookname[4096]; fd_set fds; u_short *csum; NgMkSockNode(NULL, &csock, &dsock); snprintf(ngc.path, sizeof(ngc.path), "xl0:"); snprintf(ngc.ourhook, sizeof(ngc.ourhook), HOOKNAME); snprintf(ngc.peerhook, sizeof(ngc.peerhook), "upper"); NgSendMsg(csock, ".", NGM_GENERIC_COOKIE, NGM_CONNECT, &ngc, sizeof(ngc)); snprintf(ngc2.path, sizeof(ngc2.path), "xl0:"); snprintf(ngc2.ourhook, sizeof(ngc2.ourhook), HOOKNAME2); snprintf(ngc2.peerhook, sizeof(ngc2.peerhook), "lower"); NgSendMsg(csock, ".", NGM_GENERIC_COOKIE, NGM_CONNECT, &ngc2, sizeof(ngc2)); for (;;) { bzero(buf, sizeof(buf)); bytesread = NgRecvData(dsock, buf, sizeof(buf), hookname); if (! strcmp(hookname, "myhook")) { printf("%s !\n", hookname); NgSendData(dsock, HOOKNAME2, buf, bytesread); } if (! strcmp(hookname, "myhook2")) { printf("%s !\n", hookname); NgSendData(dsock, HOOKNAME, buf, bytesread); } } } Thanks, Sebastien. -- [EMAIL PROTECTED] ----- Original Message ----- From: "Julian Elischer" <[EMAIL PROTECTED]> To: "Sebastien Petit" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 09, 2002 9:35 PM Subject: Re: Netgraph question > there is a node called etf (ethertype filter) > that can allow different nodes to share an ethernet interface > The ppp daemon needs to be modified a bit to be able to use it.. > > Brian, what does it take to allow one to specify a different node and > hook? > I.e. > > if I hook an ethertype filter onto the interface and set it up > to send pppoe to hook A and everything else to hook B is there soem way I > can tell PPP to uset node etf0:B rather than fxp0:orphans? > > The etf type is not MFC'd to 4.x yet.. > I need to do that! thanks for reminding me.. > > > > On Tue, 9 Apr 2002, Sebastien Petit wrote: > > > Hi, > > > > Actually I rewrote loadd (a load balancing daemon) for running with > > netgraph. In the original version, loadd use Divert sockets with ipfw > > for taking incoming/outgoing traffic. What node I must use for doing > > the same thing ? I try to use ng_ether but if I do that, People that > > run pppoe on the same device as load balancing can't use it. > > > > Any idea ? > > > > Sebastien. > > -- > > [EMAIL PROTECTED] > > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message