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

Fix hexadecimal qdisc/class id matching #3

Merged
merged 1 commit into from
Mar 10, 2018

Conversation

mgreter
Copy link
Contributor

@mgreter mgreter commented Feb 28, 2018

First thanks for this useful piece of code, got it up and running quite easily. But I've hit some minor obstacles while configuring my "user" rules. I have some tc classes that are reported by tc like this:

class htb 1:80 parent 1:1 ...

So I thought the following config would work

user = "class" "wan0:1:80" "wan0:1:81"

But I did not see these classes in the returned tcUserNameLeaf. Debugged the issue down (first time doing something in go) and found that results from tc are parsed via strconv.ParseInt(matchSlice[2], 16, 32) and the derived tc name is done via strconv.FormatInt(classHandle, 10), therefore not matching the configuration (eg. 1:80 become 1:128). This PR is of course a breaking change, but I guess nobody else has hit this so far or he/she should probably have reported it already (and I don't think this was intentional).

@googlebot
Copy link
Collaborator

Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
  • Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
  • The email used to register you as an authorized contributor must also be attached to your GitHub account.

@mum4k mum4k self-requested a review March 1, 2018 20:45
@mum4k
Copy link
Owner

mum4k commented Mar 1, 2018

Hello Marcel,

thank you very much for the contribution and for finding this embarrassing bug ;)

I think we will also need to update some tests. Sadly this was one of my older repositories and I didn't have continuous testing enabled. I have added that now and the Travis-CI output should indicate which tests need to be updated. The tests will also help us by ensuring that the fix actually fixes the issue. I am sure you have tested it locally, however tests will give us the guarantee going forward.

Secondly since this is Google-owned code I will ask you to sign the CLA (see the comment from the googlebot) first. Please respond on the pull request once the above checks are all green (CLA signed and tests passing).

Again thanks for your time and help!

@mum4k
Copy link
Owner

mum4k commented Mar 1, 2018

Fixes #4

Ids from tc are parsed hexadecimal where as tc names
in config user rules are parsed as regular integers.
@googlebot
Copy link
Collaborator

CLAs look good, thanks!

@coveralls
Copy link

coveralls commented Mar 9, 2018

Pull Request Test Coverage Report for Build 15

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 79.967%

Totals Coverage Status
Change from base Build 6: 0.0%
Covered Lines: 487
Relevant Lines: 609

💛 - Coveralls

@mgreter
Copy link
Contributor Author

mgreter commented Mar 9, 2018

All done, test pass, have a nice weekend!

Copy link
Owner

@mum4k mum4k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much Marcel.

@mum4k mum4k merged commit 3812b24 into mum4k:master Mar 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants