I switched to the pcap newer version on LINUX.  This helped and now I do
not see any problems while changing the filter condition dynamically

-----Original Message-----
From: Loris Degioanni [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 21, 2004 1:40 PM
To: [EMAIL PROTECTED]
Subject: Re: [WinPcap-users] Changing filter condition dynamically works
fine on Windows but fails on LINUX

Well, if you try to bypass libpcap with a program that makes direct use
of
the Linux capture interface (based on sockets if I remeber well) and the
problem is still there, this means that there's some glitch in the Linux
kernel. Otherwise, the cause is libpcap.

Loris


> Loris,
> Thank you. Are there any tests that will help me to identify the
> problem?
>
> -----Original Message-----
> From: Loris Degioanni [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 19, 2004 12:21 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [WinPcap-users] Changing filter condition dynamically
works
> fine on Windows but fails on LINUX
>
> I hardly believe this. pcap_loop and pcap_next are simply two
interfaces
> to
> access the same underlying capture system, and your prblem is in the
> capture
> systems.
>
> Loris
>
> > I need to change the filter condition dynamically.  So I have
another
> > thread that changes filter expression.
> >
> > This code works fine on Windows changing the filter condition.  On
> LINUX
> > if I change a filter condition no packages come anymore through
> > pcap_next.
> >
> >
> > Will it help to use pcap_loop instead of pcap_next (pcap_next_ex on
> > Windows)?
> >
> > Thank you
> >
> >
> > Alex
> >
> >
> >
> > while((res = pcap_next_ex( m_adhandle, &header, &pkt_data)) >= 0){
> >
> >                               bpf_u_int32 NetMask=0xffffff;
> >
> >                               struct bpf_program fcode;
> >
> >                               if(pcap_compile(m_adhandle, &fcode,
> > packet_filter, 0, NetMask) <0 )
> >
> > {
> >
> > if (changeFilter)
> >
> > {
> >
> >             if(pcap_compile(m_adhandle, &fcode, packet_filter, 0,
> > NetMask) <0 )
> >
> >             {
> >
> >                   fprintf(stderr,"\nUnable to compile the packet
> filter.
> > Check the syntax.\n");
> >
> >
> return
> > -1;
> >
> >             }
> >
> >
> >
> >       //set the filter
> >
> > if(pcap_setfilter(m_adhandle, &fcode)<0)
> >
> > {
> >
> >                   fprintf(stderr,"\nError setting the filter.\n");
> >
> >                   return -1;
> >
> >             }
> >
> >       }
> >
> >
> >
> > if(res == 0)
> >
> >             /* Timeout elapsed */
> >
> >             continue;
> >
> >       packet_handler(header, pkt_data);
> >
> >  }
> >
> >
> >
> >
> >
> > ==================================================================
> >  This is the WinPcap users list. It is archived at
> >  http://www.mail-archive.com/[EMAIL PROTECTED]/
> >
> >  To unsubscribe use
> >  mailto: [EMAIL PROTECTED]
> > ==================================================================
>
>
>
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[EMAIL PROTECTED]/
>
>  To unsubscribe use
>  mailto: [EMAIL PROTECTED]
> ==================================================================
>
>
>
>
>
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[EMAIL PROTECTED]/
>
>  To unsubscribe use
>  mailto: [EMAIL PROTECTED]
> ==================================================================



==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================






==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================

Reply via email to