Граф коммитов

104 Коммитов

Автор SHA1 Сообщение Дата
Alessandro Gario 6a54714ec2
cmake: Add base targets (#882)
Signed-off-by: Alessandro Gario <alessandro.gario@gmail.com>
2022-04-26 05:39:37 -07:00
Dave Thaler 086b80149d
Nuget package (#999)
* WIP: Developer nuget package

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Add bpf2c utility

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Build nupkg from within VisualStudio

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Don't use relative path to externals

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Update props file in nuget package

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Fix include and library paths

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Fix debug build

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
2022-04-25 10:26:56 -07:00
Shankar Seal a40b87d61d
Fix issues in NMR module implementations. (#988)
* bug fix.

* fix NMR modules bug.

* PR Feedback.

* PR feedback 2.
2022-04-21 17:41:24 -07:00
Shankar Seal ec26f5d273
WFP ALE Flow established callout, tests etc. (#978)
* WFP ALE Flow established callout, tests etc.

* PR Feedback.

* bug fixes.

* PR feedback 2.
2022-04-20 16:48:20 -07:00
Shankar Seal a1a2c6ad92
Sockops 1 (#952)
* remove dependabot from the fork.

* Revert "remove dependabot from the fork."

This reverts commit c542c6cd44.

* add sock_ops program and attach types.

* PR Feedback.
2022-04-14 15:09:54 -07:00
Shankar Seal 745bac282e
Sock addr hook callout test (#922)
* remove dependabot from the fork.

* Revert "remove dependabot from the fork."

This reverts commit c542c6cd44.

* Program info and hook NPI providers for sock_addr.

* PR Feedback.

* PR Feedback 2.

* sock_addr hook tests.

* PR feedback.

* PR Feedback 2.

* fix.
2022-04-12 11:37:44 -07:00
Shankar Seal a9ab3370d5
`bpf_prog_attach` API and other changes. (#891)
* remove dependabot from the fork.

* Revert "remove dependabot from the fork."

This reverts commit c542c6cd44.

* Program info and hook NPI providers for sock_addr.

* Program info and hook NPI providers for sock_addr.

* PR Feedback.

* PR Feedback 2.

* wfp callout for sock_addr hook.

* PR Feedback.

* fix build break.
2022-04-07 18:18:53 -07:00
Shankar Seal 04582d3f50
Sock addr hook (#871)
* remove dependabot from the fork.

* Revert "remove dependabot from the fork."

This reverts commit c542c6cd44.

* Program info and hook NPI providers for sock_addr.

* fix analysis break.

* PR Feedback.

* PR Feedback 2.
2022-04-05 16:37:34 -07:00
Shankar Seal f896c5244e
Add BPF_PROG_TYPE_CGROUP_SOCK_ADDR support (#858)
* Add BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type and CGROUP_INET4/6_CONNECT/RECV_ACCEPT attach types.

* PR Feedback #1.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-03-31 19:49:13 -07:00
Alan Jowett fd94c807a5
Centralize compiler options (#823)
* Centralize all compiler options

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2022-03-29 10:41:09 -06:00
Shankar Seal ecea57b4d8
Change extensions npiid (#841)
* remove dependabot from the fork.

* change extension provider NPI IDs.

* PR feedback.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-03-28 11:26:19 -07:00
Shankar Seal a8e3a30767
Support attaching XDP program per NIC. (#803)
* Support attaching XDP program per NIC.

* PR Feedback.

* fix bug.

* PR Feedback.
2022-03-14 15:16:11 -07:00
Shankar Seal 40915b0d15
Netebpfext refactor (#776)
* fix crash.

* use NMR APIs.

* program info provider; bind program info

rename attach provider as hook provider

function renaming

* refactor hook providers.

* async client detach.

* cicd automation and documentation.

* PR Feedback.

* switch to server 2019.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2022-02-25 17:53:12 -08:00
Dave Thaler 59c0b4e185
Allow attaching an XDP program to a specific ifindex (#755)
* Allow attaching an XDP program to a specific ifindex
* Update tests since droppacket.o changed
* Add ifindex use back to droppacket.c for testing purposes
* Verify xdp program to unlink is actually an XDP program
* Add comment re moving xdp fd replace logic to execution context
* Add libbpf test and add support for bpf_xdp_query_id

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2022-02-14 16:40:56 -08:00
saxena-anurag 3b118fa779
netebpfext fix (#663) 2021-11-18 14:24:55 -08:00
Shankar Seal 01384c7880
Add filter in outbound L2 layer. (#641)
* Add filter in outbound L2 layer.

* PR Feedback.

* Apply suggestions from code review

Co-authored-by: Dave Thaler <dthaler@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-10-20 21:18:31 -07:00
Shankar Seal 4dfff59f49
make bpf_csum_diff a global helper. (#625)
* make bpf_csum_diff a global helper.
2021-10-04 11:29:36 -07:00
Shankar Seal 97bd9cf7f6
add ingress interface index to xdp context. (#623)
* add ingress interface index to xdp context.

* Address PR feedback.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-10-04 10:53:42 -06:00
Dave Thaler 17dbbefaad
Fix sample project dependencies (#591)
* Fix sample project dependencies

Bug was that if you cleaned everything and then tried to build just the
sample_ebpf_ext project, building would fail.  A race condition also
existed when trying to build everything in that if
execution_context_kernel wasn't't done building by the
time sample_ebpf_ext was ready to link, the build would also fail.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Clean up other linker inputs

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-22 12:12:20 -07:00
Shankar Seal b04620eeee
bpf_xdp_adjust_head Part 2 (#566)
* bpf_xdp_adjust_head Part 2

* PR Feedback.

* Fix csum_diff algorithm to use 1's complement arithmetic.
2021-09-21 09:46:35 -06:00
Alan Jowett cdcf793a54
Move generated include to include (#564)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-17 17:13:14 -06:00
Alan Jowett 488a4bf6d3
Switch to SHA256 digest algorithm (#550)
* Switch to SHA256 digest algorithm

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-16 10:24:45 -06:00
Alan Jowett cc9d0b06cc
First unregister for callouts, then unregister the provider (#532)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-14 15:48:56 -06:00
Alan Jowett e553150b1b
Switch from MultiThreadedDebug to MultiThreadedDebugDll (#528)
* Switch from MultiThreadedDebug to MultiThreadedDebugDll
* Pull in latest ebpf-verifier

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 08:46:01 -06:00
Shankar Seal e84efdf092
Xdp adjust head part1 (#522)
xdp_adjust_head : Part 1
2021-09-13 17:46:23 -07:00
Shankar Seal 4d4c5b5cc7
refactor net_ebpf_ext (#520)
* refactor net_ebpf_ext
2021-09-13 14:46:43 -07:00
Shankar Seal acb6859758
Support for xdp_tx. (#498)
* xdp_tx

* Fix analysis error.

* update documentation.

* IPv6 tests.

* Apply suggestions from code review
2021-09-09 22:34:03 -07:00
Shankar Seal 8ee6344a1c
XDP ethernet packet (#493)
* cleanup test code.

* xdp eth packet.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-09-07 14:07:17 -06:00
Alan Jowett 866f8a6917
Fix non-determinism in build due to multiple projects generating header (#496)
* Fix non-determinism in build due to multiple projects generating header
* Only regenerate git_commit_id.h on change

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-07 13:22:49 -06:00
Alan Jowett 74daa0fcec
Set ps unrestricted (#483)
* Set ExecutionPolicy Unrestricted for PS script in build

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-02 14:54:03 -06:00
Alan Jowett ac9b6282b8
Add version info to ebpfcore.sys, ebpfapi.dll, netebpfext.sys, and ebpfsvc.exe (#478)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-01 17:57:35 -06:00
Dave Thaler c99a43e5e9
Revert "Remove dead code (#381)" (#401)
This reverts commit 7d779cf117.
2021-08-20 12:07:57 -07:00
Shankar Seal 7d779cf117
Remove dead code (#381)
* Remove dead code

* Address PR feedback

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-08-13 14:56:36 -06:00
Alan Jowett 4bebd3aaa1
Verify that program type is supported by attach provider (#348)
* Verify that program type is supported by attach provider

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-07-27 16:33:58 -07:00
Shankar Seal 18456999b7
move map helper function prototypes to EC (#337)
* move map helper function prototypes to EC
* replace 'generic' by 'general'

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-07-22 15:31:01 -07:00
Dave Thaler 4d0ac1bd4d
Replace "information" with "info" for consistency (#331)
Previously some places had "info" and some had "information".
Both appear in dictionaries, so guidance to avoid abbreviations does not apply.

Fixes #314

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-07-07 11:16:35 -07:00
Alan Jowett 7870921e02
Additional analysis fixes (#315)
* Fix C26110,C28023,C28193,C6001,C6031,C6054
* Fix C6101

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-29 15:51:41 -06:00
Shankar Seal a93f4ba714
program information serialization (#302)
* program information serialization.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-28 16:47:34 -07:00
Alan Jowett 576ef7381c
Enable driver specific code-analysis rules (#310)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-25 11:11:29 -06:00
Alan Jowett 9d798031b4
Fix warnings due to C6011 - NULL pointer deref (#307)
* Switch from _Pre_maybenull_ to _In_opt_

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix C6011

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix C6011 in PreprocessCommand

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-25 10:24:03 -06:00
Dave Thaler a46b00c2e3
Add VM setup scripts and docs (#281)
* Create an install script rather than having to manually do lots
  of steps
* Make Debug build use vcruntime as static libs to avoid adding
  another prerequisite on a machine before installing eBPF.  This
  isn't required for Release builds as vcruntime release DLLs
  are part of Windows, unlike vcruntime debug DLLs

Fixes #248

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-15 08:44:43 -07:00
Alan Jowett 3a73482d66
Abstract hook registration and handle passive and dispatch (#265)
* Abstract hook registration and handle passive and dispatch

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Switch to new license header format

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Clarify memory barrier

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add SAL annotation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Switch to approved license header format (#268)

* Switch to approved license header format

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add comments to clarify how the code works

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-10 15:18:29 -06:00
Alan Jowett 9e8b88a41a
Switch to approved license header format (#268)
* Switch to approved license header format

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-10 12:02:00 -07:00
Alan Jowett f779bea333
Switch to SynchronizationEvent (#264)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-10 11:15:47 -06:00
Dave Thaler 6be20d7aad
Simplify names of some ebpf_result codes (#256)
* Simplify names of some ebpf_result codes

* Remove _ERROR_ for consistency
* Combine EBPF_INVALID_HANDLE and EBPF_INVALID_OBJECT
* Rename EBPF_ERROR_NOT_FOUND to EBPF_KEY_NOT_FOUND for consistency with the associated description.
* Change code that returned EBPF_ERROR_NOT_FOUND for a case other than a
key, to use a different appropriate result, so the description stays correct.

Fixes #212

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-09 19:32:57 -07:00
Alan Jowett a69d6f55ad
Synchronize client detach and hook invocation (#255)
* Synchonize client detach and hook invocation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Check for detached program before invoking

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-09 09:17:50 -06:00
Alan Jowett 7e033f0200
Remove allocations from executable memory pool (#251)
* Remove allocations from executable memory pool

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add direction to doxygen

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Clarify use of 4096 as page size

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-07 14:07:24 -06:00
Alan Jowett 4b53d101aa
Add support for allocating pages for code that can be marked read/execute (#228)
* Add LLVM for code generation proposal

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Revert "Add LLVM for code generation proposal"

This reverts commit cd896afd94.

* Work in progress

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add doxygen

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-26 14:37:04 -06:00
Dave Thaler 773b27d2c0
Merge error codes from ebpf_windows.h into ebpf_result_t (#210)
Fixes #151

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-20 12:38:58 -07:00
Alan Jowett bf6cb270ac
Update driver to return ebpf_program_data_t to verifier (#163)
* Update driver to return ebpf_program_data_t to verifier

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix typo in comment

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-11 09:53:12 -07:00
Alan Jowett c47617951a
Split public and internal headers (#154)
* Split public and internal headers

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-10 09:47:54 -06:00
Alan Jowett d9c8dc45a1
First draft of code to serialize EBPF program info (#152)
* First draft of code to serialize EBPF program info
* Add code to encode program information from extension

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-10 07:07:43 -07:00
Dave Thaler b2a41eae21
Put hook and helper APIs in common headers (#142)
Fixes #138

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-06 13:47:09 -07:00
Dave Thaler 927b2081e3
Update directory structure (#134)
Fixes #124

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-05 14:10:28 -06:00