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

Adding a Firewall NF #80

Merged
merged 244 commits into from
May 23, 2019
Merged

Adding a Firewall NF #80

merged 244 commits into from
May 23, 2019

Conversation

dennisafa
Copy link
Member

@dennisafa dennisafa commented Mar 12, 2019

Continuing @AaronCoplan 's work of adding a firewall NF. This adds LPM rules json parsing functionality and debug mode.

Summary:

This NF drops packets based on rules that follow LPM (longest prefix matching) protocol. Default behavior is to drop unless the packet matches a rule.

Usage:

This PR includes
Resolves issues
Breaking API changes
Internal API changes
Usability improvements
Bug fixes
New functionality 👍
New NF/onvm_mgr args 👍
Changes to starting NFs
Dependency updates
Web stats updates

Merging notes:

TODO before merging :

  • PR is ready for review
  • merge ubuntu upgrade PR
  • fix bug where closing nf then starting again while manager is running causes a "Cannot get LPM request" error
  • change and merge IP parse function

Test Plan:

Run from examples directory with ./start_nf.sh firewall 1 -d 1 -f rules.json for normal mode, or ./start_nf.sh firewall 1 -d 1 -b -f rules.json for debug mode (this will print when packets are dropped/forwarded)
You could also run from within the firewall directory.
Used pcap files to verify that packets that do not follow LPM rules are dropped. Verify that packets that match rules are forwarded.

Review:

  • Sanity checks, assigned to @koolzz @kevindweb

    • Run make in /onvm and /examples directories
    • Test new functionality or bug fix from the pr (if needed)
  • Code style, assigned to @koolzz @kevindweb

    • Run linter
    • Check everything style related
  • Code design, assigned to @koolzz @kevindweb

    • Check for memory leaks
    • Check that code is reusable
    • Code is clean, functions are concise
    • Verify that edge cases properly handled
  • Performance, assigned to @koolzz @kevindweb

    • Run Speed Tester NF, report performance.
    • Run pktgen, report performance (if needed)
    • Run mTCP epserver, verify wget works, report performance for epwget/ab (if needed)
  • Documentation, assigned to @koolzz @kevindweb

    • Check if the new changes are well documented, in both code and READMEs

@koolzz
Copy link
Member

koolzz commented Apr 26, 2019

@dennisafa Fix Makefile conflict

@nks5295 Did you have any specific tests in mind? As this is just an example like most of our NFs the testing was pretty minimal. If not I'll just run a few quick tests and merge

@dennisafa
Copy link
Member Author

dennisafa commented Apr 29, 2019

There are a few issues I need to take care of since the latest merge. I will fix asap @koolzz
Edit: good to go

Copy link
Member

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

I've tested with speed_tester and pcaps. Things work as expected so I'm approving!
I've added a few naming nits/code style things. Once you fix those we're good to merge

examples/firewall/firewall.c Show resolved Hide resolved
onvm/onvm_mgr/onvm_nf.c Show resolved Hide resolved
onvm/onvm_mgr/onvm_nf.c Outdated Show resolved Hide resolved
onvm/onvm_nflib/onvm_common.h Outdated Show resolved Hide resolved
onvm/onvm_nflib/onvm_nflib.h Outdated Show resolved Hide resolved
Copy link
Member

@nks5295 nks5295 left a comment

Choose a reason for hiding this comment

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

Looks good overall, but a couple simple fixes to adhere to our naming conventions

onvm/onvm_mgr/onvm_nf.c Outdated Show resolved Hide resolved
onvm/onvm_nflib/onvm_common.h Outdated Show resolved Hide resolved
@koolzz
Copy link
Member

koolzz commented May 20, 2019

@onvm do your thing

@onvm
Copy link

onvm commented May 20, 2019

@onvm do your thing

CI Message

Your results will arrive shortly

Copy link

@onvm onvm left a comment

Choose a reason for hiding this comment

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

@onvm do your thing

CI Message

Run successful see results:
✔️ PR submitted to develop branch
✔️ Speed tester performance check passed
❌ Linter Failed (please fix style errors)

[Results from nimbnode30]

  • Median TX pps for Speed Tester: 35231909
  • Performance rating - 100.66% (compared to 35000000 average)

Linter Output

examples/firewall/firewall.c:47: "unistd.h" already included at examples/firewall/firewall.c:42 [build/include] [4]
examples/firewall/firewall.c:114: Lines should be <= 120 characters long [whitespace/line_length] [5]
examples/firewall/firewall.c:137: Almost always, snprintf is better than strcpy [runtime/printf] [4]
examples/firewall/firewall.c:142: Lines should very rarely be longer than 150 characters [whitespace/line_length] [4]
examples/firewall/firewall.c:265: Almost always, snprintf is better than strcpy [runtime/printf] [4]
Total errors found: 5
onvm/onvm_nflib/onvm_pkt_helper.c:378: Lines should be <= 120 characters long [whitespace/line_length] [5]
onvm/onvm_nflib/onvm_pkt_helper.c:378: Never use sprintf. Use snprintf instead. [runtime/printf] [5]
Total errors found: 2

Copy link
Member

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

@dennisafa alsmost good to merge, pls fix the linter suggestions from ci + the ones I've pointed out.

examples/firewall/firewall.c Outdated Show resolved Hide resolved
examples/firewall/firewall.c Outdated Show resolved Hide resolved
examples/firewall/firewall.c Outdated Show resolved Hide resolved
examples/firewall/firewall.c Show resolved Hide resolved
@dennisafa
Copy link
Member Author

@onvm dance your dance

@onvm
Copy link

onvm commented May 21, 2019

@onvm dance your dance

CI Message

Your results will arrive shortly

Copy link

@onvm onvm left a comment

Choose a reason for hiding this comment

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

@onvm dance your dance

CI Message

Run successful see results:
✔️ PR submitted to develop branch
✔️ Speed tester performance check passed
✔️ Linter passed

[Results from nimbnode30]

  • Median TX pps for Speed Tester: 35246316
  • Performance rating - 100.70% (compared to 35000000 average)

@dennisafa
Copy link
Member Author

@onvm one more time

@onvm
Copy link

onvm commented May 21, 2019

@onvm one more time

CI Message

Your results will arrive shortly

Copy link

@onvm onvm left a comment

Choose a reason for hiding this comment

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

@onvm one more time

CI Message

Run successful see results:
✔️ PR submitted to develop branch
✔️ Speed tester performance check passed
✔️ Linter passed

[Results from nimbnode30]

  • Median TX pps for Speed Tester: 35241691
  • Performance rating - 100.69% (compared to 35000000 average)

@koolzz koolzz merged commit a003a40 into sdnfv:develop May 23, 2019
@koolzz koolzz added this to the ONVM 19.05 Release milestone May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants