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

221 Коммитов

Автор SHA1 Сообщение Дата
Alan Jowett cfd451c64e
Refactor CI/CD to decrease iteration time (#919)
* Refactor CI/CD to decrease iteration time

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

* PR feedback

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

* Fix driver test

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

* Fix driver test

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>

* 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>

* Fix up driver tests

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

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-04-11 10:05:20 -07:00
Dave Thaler d00377f074
Make map definition more cross-platform compatible (#904)
Fixes #903

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2022-04-07 18:53:21 -07:00
saxena-anurag 54516ec2c7
Add mock layer to run native module test cases in user mode (#889)
* add mock layer to test native module load

* Apply suggestions from code review

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

* make unit_test dependent on dll projects

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2022-04-06 17:43:28 -07:00
saxena-anurag 68a740223c
bpf2c: emit maps in order they appear in ELF file (#883)
* bugfix

* Update tests/api_test/api_test.cpp

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

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-04-05 16:16:02 -06:00
Dave Thaler b9d46ae8e4
Use upstream main branch for ebpf-verifier (#894)
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2022-04-05 11:01:36 -07:00
saxena-anurag 3470d6d7b7
EC and API changes to load generated BPF driver (#811)
* initial_commit

* fix build

* fix build

* fix build break due to merge

* debug build

* api changes, other changes

* bpf2c change to enmit program type, other fixes

* hydrate UM ebpf_object, other fixes

* remove logic to disable programs

* fixes

* fix sal

* build break

* build break

* fix sal errors

* fixes

* fix bpf2c_tests failure

* unload driver when program ref count becomes 0, other minor fixes

* fixes

* tail_call fixes, add test cases, other fixes

* build break

* build break

* code cleanup

* fix bad merge

* code cleanup

* code cleanup

* cleanup

* Apply suggestions from code review

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

* cr comments

* Apply suggestions from code review

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

* cr comments

* Apply suggestions from code review

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

* cr comments

* cr comments

* Apply suggestions from code review

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

* address cr comments

* Apply suggestions from code review

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

* add tracing in ebpfcore, other fixes

* tracing

* add section for each map in sample

* do not delete the native service

* fix bad merge

* remove code to delete service, other fixes

* cr comments

* bpf2c should read and populate all the maps in ELF file

* add test case for creating map-in-map from native driver

* Apply suggestions from code review

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

* cr comments

* add tracing for api code changes

* rename epbf_native_t to ebpf_native_module_t

* fix bad merge

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-04-01 12:52:04 -07:00
saxena-anurag 69fd71f6f3
bpf2c should read and populate all the maps in ELF file (#865) 2022-04-01 10:37:55 -07:00
Alan Jowett 719518ae6c
Fail code generation for non-map relocations (#859)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2022-03-30 14:47:26 -06: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
Alan Jowett 159e1e404f
Annotate prolog lines with #line directive (#816)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2022-03-18 11:29:26 -06:00
Shankar Seal d5cf5e8622
support interface parameter for loading XDP program in netsh ebpf con… (#790)
* support interface parameter for loading XDP program in netsh ebpf context.

* PR Feedback.

* PR Feedback.
2022-03-09 16:15:58 -08:00
Dave Thaler 980646a793
Improve netsh helper initialization error message output (#788)
* Improve netsh helper initialization error message output

Fixes #787

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

* Updated code comment

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2022-03-01 12:51:41 -08: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
Alan Jowett 6b12786c31
Fix missed PR feedback (#774)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-02-25 18:27:27 -07:00
Alan Jowett aa87ee0ce2
Emit either bare code, sys, or dll (#769)
* Emit either bare code, sys, or dll

Resolve #767
2022-02-24 11:18:28 -07:00
Alan Jowett 1dafb123d6
Emit function name if found (#771)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2022-02-22 18:01:54 -07:00
Alan Jowett e5aec8985c
Parse BTF data if present and emit #line directives (#764)
* Parse BTF data if present and emit #line directives

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2022-02-16 12:49:04 -07:00
Alan Jowett 430e575f1a
Add tool to generate C code from eBPF byte code in ELF file (#757)
Add bpf2, a tool to generate C programs from eBPF instructions in an ELF file.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-02-15 17:44:23 -07: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
Dave Thaler 34598edf84
Update bpftool and libbpf dependencies (#744)
* Update bpftool

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

* Update paths to libbpf and bpftool

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

* Add more libbpf APIs

* Added bpf_map_create, bpf_object__next_map, bpf_object__next_program, bpf_object__prev_map, bpf_object__prev_program
* Removed obsolete exports ebpf_create_map and ebpf_create_map_name
* Updated prototype of bpf_program__attach and bpf_progam__attach_xdp to
  match latest libbpf header

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

* Address code review feedback

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2022-02-08 13:21:19 -08:00
saxena-anurag 6b4dda75a1
remove ebpf_api_initiate, ebpf_api_terminate from sources (#738)
* remove ebpf_api_initiate, ebpf_api_terminate from sources

* cleaup traces

* cleanup traces
2022-01-31 08:32:28 -08:00
Dave Thaler 80c953280e
Add libbpf bpf_prog_bind_map() API (#611)
* Add libbpf bpf_prog_bind_map() API

Fixes #379

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

* Fix SAL annotation

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

* Fix leak

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

* Address feedback

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

* Make program lock protect the set of maps associated with the program

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
2021-09-30 11:43:06 -06:00
Dave Thaler ce12b0cb0c
Initial bpftool port (#597)
* Initial libbpf port

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-28 11:44:26 -07:00
Dave Thaler 20d7a6565e
Add more libbpf APIs needed by bpftool (#576)
* Add more libbpf APIs needed by bpftool

* Add missing export for existing bpf_map__name API
* Add bpf_object__load
* Add bpf_object__load_xattr
* Add bpf_object__open_file
* Add bpf_object__unload() API
* Add bpf_program__get_type
* Add bpf_program__set_type
* Add bpf_program__unload() API
* Add libbpf_get_error
* Add libbpf_num_possible_cpus
* Rename BPF_MAP_TYPE_UNSPECIFIED to BPF_MAP_TYPE_UNSPEC for libbpf
  compat
* Rename BPF_PROG_TYPE_UNKNOWN to BPF_PROG_TYPE_UNSPEC for libbpf compat
* Add attach_type to bpf_link_info
* Add map_flags to bpf_map_info (but currently always 0)

Fixes #575

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-23 19:32:09 -07:00
Dave Thaler 6d3be2a0c2
Fix netsh "show maps" output (#581)
* Fix netsh "show maps" output

* Display correct inner map ID
* Display Map ID
* Display count of # paths pinned
* Correct "set program" help text

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

* Fix rebase

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-09-21 10:34:13 -06:00
Dave Thaler 52e4acdcdf
Add option to pin all programs added, and show links and maps (#553)
* Add option to pin all programs added and show links and maps

* "add programs" now supports the equivalent of bpftool's "prog loadall"
  in addition to just "prog load"
* add "show links" netsh command
* expose "show maps" netsh command.  It was partially implemented but
  never exposed before.
* remove ebpf_map_query_definition() and test as being redundant with
  bpf_obj_get_info_by_fd() (and in the future, a strongly typed one that
  is map specific but different from the query map definition prototype)
* Fix bug where getting the next ID failed to check for index beyond
  array size.  And add test cases for it.
* Fix bug in ebpf_state.c where after enough tests ran it would start
  returning EBPF_NO_MEMORY because _ebpf_state_next_index was never
  reset.

Addresses #549

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-17 18:52:47 -07: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 967990f700
Disable /ZI and incremental linking (#546)
* Disable /ZI and incremental linking

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-16 16:49:02 -06:00
Dave Thaler 872999db06
Add netsh capability to unpin programs (#539)
* Add netsh capability to unpin programs

* The netsh "set program id=<id> pinned=" (with no value) will now unpin a
  program from all paths
* The netsh "delete program <id>" will now unpin a program from all
  paths before and releasing any reference held by netsh itself
* Make the "attached=<string>" argument to netsh set programs work
  with a section name like string
* Add libbpf api bpf_obj_get()
* Add ebpf_get_next_pinned_program_name() API to enumerate pinned
  programs

Fixes #190 #373

This is required for #188 which will update the "show programs"
and also add an option to "add program" to pin all programs rather
than just the first one in a file, like bpftool has such an option.

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

* Update mock netsh behavior since PR 540 changed the underlying requirements

PreprocessCommand now correctly matches tags so you can specify a later
optional tag without having to specify earlier optional tags

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-15 18:40:44 -07:00
Dave Thaler aa09128ae0
Add libpf's libbpf_prog_type_by_name() API (#534)
* Add libpf's libbpf_prog_type_by_name() API

And add an ebpf_get_program_type_by_name() that returns the GUIDs
instead of ints.

This also removes the hard-coding of GUIDs or ints from the netsh
helper.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-15 12:08:18 -07:00
Dave Thaler 12bb2e7195
Update netsh commands to use more standard libbpf apis (#527)
* Update netsh commands to use more standard libbpf apis

* Add support for libbpf bpf_obj_pin() API
* Add support for libbpf bpf_object__next() API
* Rename BPF_{PROG,ATTACH}_TYPE_UNKNOWN to ...UNSPEC for libbpf compat
* Remove now-unused handle APIs ebpf_api_load_program and
  ebpf_api_pin_object, which is part of issue #383
  * netsh set/delete program now uses the ID to identify the program,
    like bpftool does, so that it can work even if the program wasn't
    loaded from an ELF file

Fixes #191

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-14 10:59:57 -07:00
Alan Jowett f5ba5c5d7c
Use CRT library to map handles to fds (#513)
* Use CRT library to map handles to fds

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 09:25: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 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
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
Shankar Seal dae2a4def5
clean up test code (#492)
* cleanup test code.

* PR feedback.
2021-09-07 08:46:07 -07: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 dd3f1b427c
Rename ebpf_helpers.h to bpf_helpers.h for cross-plat compat (#472)
Libbpf has bpf_helpers.h which is mostly platform-agnostic, and
bpf_helper_defs.h which is platform-specific but is included
by bpf_helpers.h.   Until libbpf is made more platform-agnostic
(issue #351), the workaround is to have a separate pair of files.
Our bpf_helpers.h and our own bpf_helper_defs.h, both of which
would ideally be merged into libbpf's in the future.

Platform-specific defines are in ebpf_struct.h, though that
name may need to change later on.  Linux uses "linux/bpf.h"
(e.g., as used in the https://docs.cilium.io/en/v1.8/bpf/ and
https://developers.redhat.com/blog/2021/04/01/get-started-with-xdp
articles) or "vmlinux.h" (e.g., as used in the
https://ruderich.org/simon/notes/xdp-minimal-example article),
and these filenames are hard coded in eBPF programs.  In the future,
we should probably settle on a cross-platform name and use include
paths to distinguish them, as opposed to requiring ifdefs in eBPF
programs.  However, all of that is part of issue 351 and not this
issue.

Also removed obsolete/unused "repro.c" from tests/samples

Fixes #426

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-09-01 16:30:33 -07:00
Dave Thaler d5c275acb3
Add netsh command to show maps (#476)
Signed-off-by: Dave Thaler <dthaler@microsoft.com>

Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
2021-09-01 08:10:39 -07:00
Shankar Seal c764977442
utility general helper functions. (#450) 2021-08-28 11:05:57 -07:00
Alan Jowett 4be43a7ea1
Include required Clang version (#431)
* Update Getting Started to recommend current release version of Clang/LLVM

Clang-format behaves differently depending on the version of Clang installed.
Update getting started guide to recommend Clang / LLVM 10.0.0.
Update the development guide to indicate that Clang 10 or higher is required for consistent formatting.
Reformat all code using Clang 10.0.0

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-25 09:01:16 -06:00
Alan Jowett 16a951c2c3
Switch to hash table from AVL. Lock free in the presence of epoch allocator. (#389)
* Switch to hash table from AVL.
Lock free in the presence of epoch allocator.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-20 18:29:11 -06:00
Dave Thaler c99a43e5e9
Revert "Remove dead code (#381)" (#401)
This reverts commit 7d779cf117.
2021-08-20 12:07:57 -07:00
Dave Thaler 74c456e6b7
Update UM map APIs for libbpf compat (#388)
Since there is a name conflict between KM helpers and UM libbpf APIs,
the end-to-end tests need to _not_ include the KM helper prototypes,
so removed ebpf_helpers.h from ebpf.h and made samples include it
directly.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-18 21:06:58 -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
Dave Thaler 7c12adb067
Prevent mismatched program types in PROG_ARRAY maps (#374)
* Prevent mismatched program types in PROG_ARRAY maps

* Each prog array map has a natural progtype, determined when
  asociating it from a program, or when adding the first program
  to it, if not associated with any program.
* Trying to add a program with mismatching type will fail
* Added libbpf bpf_create_map() API
* Fixed error returns from several libbpf APIs to be negative
* For efficiency, ebpf_program_get_properties now returns a
  pointer rather than copying the data inside the execution
  context, and is renamed to ebpf_program_get_parameters()
  to match what its return type always was.
* Fixed a bug in map size calculation that resulted in a huge
  amount of memory being allocated
* Updated return type of bpf_tail_call to the value meant
  to signal stack unwind needed

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-11 12:17:10 -07:00
saxena-anurag 014ee34392
Add eBPF UM APIs (#368)
* parse map names from elf file
* add apis, change test code

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-10 17:04:07 -07:00
Dave Thaler 8f46b4020f
Revert "Add code to propagate flags for helper functions. (#365)" (#366)
This reverts commit e9a565fd0a.
2021-08-09 14:37:40 -07:00
Alan Jowett e9a565fd0a
Add code to propagate flags for helper functions. (#365)
* Add code to propagate flags for helper functions.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-09 13:33:31 -07:00
Dave Thaler a321179cee
Add prog array map type and bpf_tail_call() helper (#359)
* Add prog array map type and bpf_tail_call()

This also fixes a bug where bpf_object__find_program_by_name
could only find the first program because program->object
was always null.

Also fixes tests to correctly use a signed int for what hooks return,
instead of an unsigned int.

Not done in this PR, but will be in a separate PR:
* make tail call replace stack frame instead of simply calling into the callee
* limit number of tail calls to 32
* require the same program type for caller and callee
* test with load byte array instead of from a file

Addresses part of #344

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

* Address PR feedback

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

* Address PR feedback

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

* Add missing file

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

* Disable warning due to C enum types used in C++

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-06 14:18:47 -06:00
Dave Thaler 2617349903
Remove duplicate public APIs where standard libbpf APIs exist (#356)
* Remove duplicate public APIs where standard libbpf APIs exist

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-03 17:25:50 -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 9681a918ad
Fix issues flagged by CodeQL code scan (#324)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-30 11:11:27 -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
Dave Thaler 360aa224ea
Add some netsh tests (#295)
Adds tests for "show sections" and "show disassembly"

Addresses part of issue #240

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-23 09:54:36 -07:00
saxena-anurag c31547cff5
Add ebpf public APIs - #1 (#290)
* add ebpf_program_load(), few other APIs
2021-06-22 20:42:18 -07: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 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
Dave Thaler bf7eef76c5
Make netsh "show verification" command display max instruction count (#242)
Fixes #193

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-06-02 12:22:06 -06:00
Dave Thaler 50a773d8dc
Fix bugs in netsh helper (#238)
* Pinning a program requires a name to pin to
* The load program API doesn't correctly deal with an empty section name
  (it does use the first section but then tells the execution context
  that the section name is empty instead of the chosen one), so for now
  require the section name in any "add program" command
* Allow netsh to hold references on multiple programs
* Fix handle leak in "show programs"
* Implement ability to pin a program, but unpinning requires
  a way to look up what a program was pinned to, and no such
  API exists currently.
* Implement filtering "show programs" output by filename and section

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-01 09:47:26 -06:00
Dave Thaler d37e65801a
Fix netsh display of program type (#226)
Since the program type changed from int to GUID the display has been
broken (it displays a useless pointer value).  This fix makes it display
the string name of the type.

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-25 22:05:03 -07:00
Dave Thaler faebbdd32a
Clean up compiler warnings (#225)
The IDL was generating MIDL2279 because it used const on an [out] param,
which is warned against since RPC marshaling copies the result into new
memory.  See https://marc.info/?l=ms-dcom&m=103440617317922 for some
discussion.

Other changes should hopefully be obvious.

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-25 15:36:19 -07: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 c59b072cd3
Add missing helperfunctions (#183)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-12 14:25:48 -07:00
Alan Jowett 1af5e65f65
Switch ebpf_program_type_descriptor_t::platform_specific_data to GUID (#171)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-11 14:46:00 -06: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
Dave Thaler 7a34bb0c86
Make verifier and netsh use GUIDs instead of int program types (#150)
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-08 10:45:50 -06: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