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

Common code in netebpfext.sys should be refactor for reusability #3331

Open
Alan-Jowett opened this issue Mar 6, 2024 · 2 comments
Open
Assignees
Labels
cleanup Affects API usability or code maintainability but not correctness or applicability help wanted Extra attention is needed triaged Discussed in a triage meeting
Milestone

Comments

@Alan-Jowett
Copy link
Member

The netebpfext.sys driver contains a lot of common code that makes writing eBPF extension drivers simpler.

This code should be refactored and be made available to other driver developers.

Possible options:

  1. Export Driver
  2. Static library
  3. A git submodule

An export driver is probably the most useful as it would allow a single version of the code to be patched once if there was a bug.

@Alan-Jowett
Copy link
Member Author

List all files in https://github.com/microsoft/ntosebpfext/tree/main/ntosebpfext

Total LOC - 3371
Code that is specific to this extension - 435

$ pwd
/e/ntosebpfext/ntosebpfext
$ git ls-files | xargs cat | wc -l
3371
$ cat ntos_ebpf_ext_process.c  | wc -l
413
$ cat ntos_ebpf_ext_process.h  | wc -l
22

87% of this driver code is boiler plate.

@dthaler dthaler added the cleanup Affects API usability or code maintainability but not correctness or applicability label Mar 11, 2024
@dahavey dahavey added the triaged Discussed in a triage meeting label Mar 11, 2024
@dahavey dahavey added this to the Backlog milestone Mar 11, 2024
@dv-msft dv-msft self-assigned this Mar 11, 2024
@dahavey dahavey added the help wanted Extra attention is needed label Mar 11, 2024
@mtfriesen
Copy link
Collaborator

FWIW, the XDP boilerplate that seems trivially submodule-able is in https://github.com/microsoft/xdp-for-windows/blob/main/src/xdp/ebpfextension.c. This was derived from the netebpfext codebase, but is subtly different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Affects API usability or code maintainability but not correctness or applicability help wanted Extra attention is needed triaged Discussed in a triage meeting
Projects
None yet
Development

No branches or pull requests

5 participants