Skip to content
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

Correct down/up ratio calculation #2

Merged
merged 1 commit into from
Oct 26, 2021
Merged

Correct down/up ratio calculation #2

merged 1 commit into from
Oct 26, 2021

Conversation

lisa-lthorrold
Copy link

@lisa-lthorrold lisa-lthorrold commented Oct 24, 2021

I noticed that all the down/up ratio values were either 0 or 1. Tracking back to the code, the backward.size() is an int, and this.forward.size() is an int. int/int = int.

I believe the original author intended to return a proper ratio (double return type), but it doesn't look like they correctly cast one of the values to a double so to ensure correct calculation; instead they casted the value returned by integer division to a double.

@GintsEngelen GintsEngelen merged commit fdc889e into GintsEngelen:master Oct 26, 2021
@GintsEngelen
Copy link
Owner

Indeed, I double-checked it and the values I saw for the Down/Up Ratio were all whole numbers. After your fix, I reran the CICFlowMeter tool and the values now correctly reflect (Total Bwd Packets) / (Total Fwd Packets).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants