Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

use tbpoc-bfp shape ingress egress by ip #1

Open
micron10 opened this issue Oct 2, 2019 · 6 comments
Open

use tbpoc-bfp shape ingress egress by ip #1

micron10 opened this issue Oct 2, 2019 · 6 comments

Comments

@micron10
Copy link

micron10 commented Oct 2, 2019

Hi compile tbpoc-bfp and now i whan to test to set speed to one of ips in network for down/up
please write example how to set this ?

@qmonnet
Copy link
Owner

qmonnet commented Oct 2, 2019

Hi, sorry I'm not sure what you mean. Do you mean applying the token bucket to just a given IP address, or do you mean applying it to all IPs but with a different rate for one given IP address?

In both cases, you would have to check that your packets are IP, then compare the IP source or destination from IP header to that specific IP addess you want to process. And then, the rate to apply can be changed via the TB_TOKEN_NB and TB_TOKEN_REGEN constants in https://github.com/qmonnet/tbpoc-bpf/blob/master/tokenbucket.c.

I hope this helps?

@micron10
Copy link
Author

micron10 commented Oct 2, 2019 via email

@qmonnet
Copy link
Owner

qmonnet commented Oct 2, 2019

So you would have to filter on IP addresses, see how we get the source IP already. Compare the first three bytes of your IPs with the network prefixes you work with, and depending on the case, use the values associated to the desired rate.

The simplest way to have this would be to hardcode network prefixes and rates in your code. The “clean” way would be instead to pass them via a dedicated eBPF map.

@micron10
Copy link
Author

micron10 commented Oct 2, 2019 via email

@qmonnet
Copy link
Owner

qmonnet commented Oct 2, 2019

No sorry, I don't have time at the moment. You'll have to do your homework :)

@micron10
Copy link
Author

micron10 commented Oct 2, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants