-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pcap_interfaces_map in pmacctd doesn't work with multiple items on same interface #531
Comments
Hi @maplewf , Thing is: ULOG/NFLOG (uacctd daemon) is well integrated in the Linux kernel and offers a header where - depending at which point a packet is sampled - one has readily available input and/or output interface. In case of libpcap (pmacctd daemon), which is portable but not well integrated in the Linux kernel, you have only one single reference point: the interface where a packet is sampled. So you can't really say packet X is ingress interface Y and egress interface Z - which is what you want. In turn, you may help yourself with pre_tag_map and src_mac / dst_mac (for example) or other primitives there available that may give you a hint of which interface the traffic is ingress / egress. Paolo |
Hi @paololucente, Please correct me if I'm wrong. What I really concern is that it can't work as expect in following way, so far, it only collect ingress traffic of eth0, ignore egress traffic, vice versa. The reason is already written in first post:
But you must complain that why not just use Of course, I can add ingress and egress configuration in different map and use different pmacctd process to handle them, but don't you think it's too inconvenience? Why not we can't use one map and one process to archive all these things?BTW, in https://github.com/pmacct/pmacct/blob/master/examples/pcap_interfaces.map.example, it doesn't forbid configuration like this. best regards. |
Hi @maplewf , I understand the source of confusion & you are right documentation should be improved. Specifying Now problem is that doing so, that is specifying Paolo |
Hi @paololucente, To be honest, I don't really understand what you said In my understanding, the problem is that pmacctd can't read
Use map with index directly instead of That's why I said at first that I don't understand you said pmacctd can't distinguish direction, I think as long as it can read all entries, then it can work perfectly. But I have to say that this fix doesn't consider the scenario of reloading map, if you think this is right thinking, then maybe it needs to be reconsidered too. best regards. |
…e the same interface is present multiple times (maybe with different directions). To address Issue #531
Hi @maplewf , I did review existing code and, indeed, pm_pcap_interfaces_map_getentry_by_ifname() has little role when looping over the interfaces map. It does not even achieve de-duplication in case the same interface is present twice, it just misbehaves. Thanks for your proposal for a code change. I just committed a piece of code, if you see it's your proposal but polished a bit. Can you give it a try and confirm it working for you? Paolo |
Hi @paololucente, I have verified the patch, it works! But about this function, I still have one comment:
This function is used to reload the interface map, but it still only return the first index of match items. So if there are one more items which has same |
…e the same interface is present multiple times (maybe with different directions). (2) To address Issue #531
Hi @maplewf , Thanks for spotting this issue, you are right & hopefully my last committed fixed these other bits. Can you please give it a try and confirm? I did test very basic scenarios and it seemed to work. Paolo |
Hi @paololucente,
you introduced the direction, but the function never use it..., so it actually nothing changed |
…e the same interface is present multiple times (maybe with different directions). (3) To address Issue #531
Hi @maplewf , Third try. Can you give it a try? If it does not work, please feel free to propose a patch too. Paolo |
It's perfect this time. Thanks for great support |
Wonderfulness @maplewf , thanks for confirming! Paolo |
Hi @paololucente,
Here is problem about pmacctd with pcap_interfaces_map configuration. Please see the pcap_interfaces_map as below:
With this configuration, pmacctd only can get traffic from
eth0 in
andeth1 in
. After checking source code, there is function calledpm_pcap_interfaces_map_getentry_by_ifname
as below:It always returns the first met value of same
ifname
in the map. I don't know if it's expected result, but for me, when you want to mark bi-direction of traffic at same time, it's not supported so far unless you start two pmacctd process for each direction.The text was updated successfully, but these errors were encountered: