Using EtherOutputHook

VxWorks

    Sponsored Links

    Next

  • 1. C++ style commenting in WorkBench
    How do i allow C++ style comment ( //this type of comment) in WorkBench when compiling and building?
  • 2. how to installed ethernet driver
    hi all, please send me answer of following query as soon as possible: How do i install Ethernet driver: i have copied all files at respective directory. now wanted to installed that driver. for that i ran make command from DOS as follow but it shows error: C:\Tornado\target\src\drv\end\unsupported> make CPU=PENTIUM error is: 'make' is not recognized as internal or external command operable program or batch file. or i have to run same from tornado shell dharmendra
  • 3. undefined symbol:_t12basic_string3ZusZt18string_char_traits1ZusZt24_default_alloc_template2b1i0$nilRep
    I am facing a weird error of the following type while loading a c++ program. I am using basic_string template class with unsigned short..The same template class with char is working on vxworks..I mean I don't get any such kind of error when i define the template class with char parameter..Anyone has any idea.. undefined symbol:_t12basic_string3ZusZt18string_char_traits1ZusZt24_default_alloc_template2b1i0$nilRep I enabled all the c++ components while building my BSP which includes INCLUDE_CPLUS_STRING...I don't find the reason why it shud happen this way..Can it be problem with Standard Template Library I am using...Please get back to me ASAP if you have any solution for this.. thanks.
  • 4. pthread
    hi all, I'm trying to use pthread within wxworks 5.5.1, pthreadLibInit doesnt seem to be present ! Is there any special configuration to do before ? br.

Using EtherOutputHook

Postby karthikh » Thu, 26 Aug 2004 06:27:36 GMT

Hi,

I am trying to read / write on raw ethernet medium from my vxworks.
I understand that that there exists few etheroutput/ether hooks API to
get my task accomplished. I have problem using them.

I did the following. 
1. I tried getting the etheroutput and etheroutputhook work. I got the
etheroutput working. I am able to send a test packet from vxWorks to a
host on windows platform, I captured using ethreal and verified. For
this to be done I gave the interface (eg, gei0) and my destination mac
ID. Then I moved to get the etherOutputHook work. I have problem over
here. Though I am able to hook successfully (atleast thats what it
says, it returns no error), I am unable to capture the packets I send
out.

Another doubt I have in using etherOutputHook is "how do u specify
which interface this hook should be listening/looking to, so that it
gets invoked when a packet gets passed thru that interface it will get
invoked. Is there a initialize function.

Another stuff I am not clear about is, what is etherOutputHookRtn,
Should I call this explicitly to make sure I capture all the packets
going in an interface or just establishing a hook will so (in that
case what's this function pointer's use)?

My code (for EtherOutputHook):

BOOL OutputHandle(struct ifnet *pIf, char *buffer, int length)
{
	int i;
	printf("hooked_packet ");
	for(i =0;i<length;i++)
		printf("%c ",buffer[i]);
	printf("\n\n");
    return (TRUE);
}

STATUS EtherOutputHook()
{
	if (etherOutputHookAdd(OutputHandle) == OK)
	{
		printf("etherOutputHookAdd successful\n");
		return(OK);
	}
	else 
	{
		printf("etherOutputHook failed\n");
		return(ERROR);
	}
}

When I spawn a task for EtherOutputHook, it says "etherOutputHookAdd
successful", in my vxWorks terminal, however I wonder where do we
specify the interface. In the OutputHandle, it just has a pIf, but no
where did I populate with my interface gei0, if I should, where should
I do it. Also again as a reminder, should I use etherOutputHookRtn
anywhere, or just hooking up a etherhook will do for me to get all
packets going in an interface.

Thanks for the help.

Regards,
Karthik

Re: Using EtherOutputHook

Postby shafi4u » Thu, 26 Aug 2004 14:22:55 GMT



Hi,
My answers are INLINE:



I believe the etherOutputHook does not work in presence of WDB agent.
I had got it working after disabling the WDB from image. I dont know
the reason.
 

You dont need to specify the interface in hook. The interface pointer
is picked from the IP which routes the packet out to particular interface.
It is an input to hook routine basically and it is decided by the IP
layer based on destination IP address of the packet.


Your etherOutputHookRtn will get called for every outgoing packet.
You need not call it. I believe it is called under the context of
tNetTask of vxWorks and it is very critical to do anything in it.



Answered above.

regards,
_shafi

Re: Using EtherOutputHook

Postby karthikh » Sun, 29 Aug 2004 01:56:21 GMT

Hi Shafi,

Thanks on your inputs. I am yet to test with disabling WDB task. I
will do that shortly post the results.

Hi All,

Got the sniffer working with MuxBind(). Its lot easier and makes more
sense than etherOutputHookAdd() / or inputHookAdd(). Just in case if
you need to sniff on packets try using muxbind(). Also heard that
etherHook will not be supported on T2.2 and future versions will have
only muxBind().

Hope it helps.

Karthik









Return to VxWorks

 

Who is online

Users browsing this forum: No registered users and 94 guest