Question

I have used struct sflt_filter which is part of kpi_socketfilter.h, to set filter for individually for either TCP or UDP protocol which is working fine.

But I want it for both TCP and UDP protocol filter in same program.

This line works for individual call -

sflt_register(&sflt_filter_variable, PF_INET, SOCK_STREAM, IPPROTO_TCP);

I already try

  1. registering single "sflt_filter_variable" variable twice.

    sflt_register(&sflt_filter_variable, PF_INET, SOCK_STREAM, IPPROTO_TCP); sflt_register(&sflt_filter_variable, PF_INET, SOCK_DGRAM, IPPROTO_UDP);

  2. creating another variable of "struct sflt_filter" and registering it separately as above.

So how can I register filter for both TCP and UDP. Any help welcomes.

Thanks.

Was it helpful?

Solution

Got The answer,

Have to change the sflt_filter_variable.sf_handle variable value to another 32 bit unique value.

sflt_register(&sflt_filter_variable, PF_INET, SOCK_STREAM, IPPROTO_TCP);

sflt_filter_variable.sf_handle = 0x7a5a5f5d;      // **changed valu of sf_handle.**
sflt_register(&sflt_filter_variable, PF_INET, SOCK_DGRAM, IPPROTO_UDP);

Hear you can get registered sf_handle values

OR you can use your own values for now.

Got At This Link refer this for more referance

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top