-
Notifications
You must be signed in to change notification settings - Fork 24
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
L3af on windows #68
base: main
Are you sure you want to change the base?
L3af on windows #68
Changes from 17 commits
2828566
0b58530
9dcec10
83599ca
b4e3351
82562dd
8f7eb82
d94aacd
814e886
5c0005d
439ab09
bf41cb8
9477b14
fd9eadc
720676d
6ec91f1
1efe406
47ba45f
1c22276
781f782
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[DEFAULT] | ||
|
||
[l3afd] | ||
pid-file: /var/l3afd/l3afd.pid | ||
datacenter: dc | ||
bpf-dir: /var/l3afd/repo | ||
bpf-log-dir: /var/l3afd/repo | ||
shutdown-timeout: 1s | ||
http-client-timeout: 10s | ||
max-ebpf-restart-count: 3 | ||
bpf-chaining-enabled: false | ||
swagger-api-enabled: true | ||
environment: DEV | ||
BpfMapDefaultPath: /sys/fs/bpf | ||
|
||
[ebpf-repo] | ||
url: C:/var/l3afd/repo | ||
|
||
[web] | ||
metrics-addr: 0.0.0.0:8898 | ||
ebpf-poll-interval: 30s | ||
n-metric-samples: 20 | ||
|
||
[xdp-root] | ||
package-name: xdp-root | ||
artifact: l3af_xdp_root.tar.gz | ||
ingress-map-name: xdp_root_array | ||
command: xdp_root | ||
version: latest | ||
object-file: xdp_root_kern.o | ||
entry-function-name: xdp_root | ||
|
||
[tc-root] | ||
package-name: tc-root | ||
artifact: l3af_tc_root.tar.gz | ||
ingress-map-name: tc/globals/tc_ingress_root_array | ||
egress-map-name: tc/globals/tc_egress_root_array | ||
command: tc_root | ||
version: latest | ||
ingress-object-file: tc_root_ingress_kern.o | ||
egress-object-file: tc_root_egress_kern.o | ||
ingress-entry-function-name: tc_ingress_root | ||
egress-entry-function-name: tc_egress_root | ||
|
||
[ebpf-chain-debug] | ||
addr: localhost:8899 | ||
enabled: false | ||
|
||
[l3af-configs] | ||
restapi-addr: localhost:53000 | ||
|
||
[l3af-config-store] | ||
filename: /var/l3afd/l3af-config.json | ||
|
||
[mtls] | ||
enabled: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ | ||
"host_name": "l3af", | ||
"iface": "Ethernet 4", | ||
"bpf_programs": { | ||
"xdp_ingress": [ | ||
{ | ||
"name": "port_quota", | ||
"seq_id": 1, | ||
"artifact": "port_quota.exe", | ||
evershalik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"cmd_start": "port_quota.exe", | ||
"version": "debug", | ||
"user_program_daemon": true, | ||
"admin_status": "enabled", | ||
"prog_type": "xdp", | ||
"cfg_version": 1, | ||
"start_args": { | ||
"load": "load" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ | ||
"bpf_programs": { | ||
"xdp_ingress": [ | ||
"port_quota" | ||
] | ||
}, | ||
"host_name": "leaf1", | ||
"iface": "Ethernet" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,85 @@ | ||||||
### Prerequisites: | ||||||
|
||||||
- [Git](https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.3/Git-2.41.0.3-64-bit.exe) | ||||||
- Cmake | ||||||
- Clang | ||||||
- Nmake | ||||||
- [Golang](https://go.dev/doc/install) | ||||||
- C++ using: [MSYS2](https://www.msys2.org/) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to know why MSYS2 is needed, so we can work to remove that dependency |
||||||
- [Visual Studio Build Tools 2022](https://aka.ms/vs/17/release/vs_buildtools.exe) | ||||||
evershalik marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
### Steps to Build l3afd on Windows: | ||||||
|
||||||
1. Clone l3afd repo: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
```bash | ||||||
git clone https://github.com/l3af-project/l3afd.git | ||||||
``` | ||||||
|
||||||
2. Build l3afd using: | ||||||
```bash | ||||||
cmake -B build | ||||||
cmake --build build | ||||||
``` | ||||||
|
||||||
>l3afd.exe file will be created after this. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### Steps to run l3afd on Windows: | ||||||
|
||||||
3. Update [l3afd_win.cfg](./cfg/l3afd_win.cfg) file: | ||||||
|
||||||
- Replace the `l3afd.cfg` file in `l3afd` repo with the above `l3afd_win.cfg` file | ||||||
- Manually create a directory and set the custom path for pid-file: `mkdir C:\var\l3afd` | ||||||
- Set `swagger-api-enabled` to **true** | ||||||
|
||||||
4. Run l3afd.exe | ||||||
```bash | ||||||
l3afd.exe | ||||||
``` | ||||||
|
||||||
![l3afd.exe](../images/l3af-on-windows/l3afd.exe_output.png) | ||||||
|
||||||
### Access Swagger API on the dashboard: | ||||||
Go to this webpage: http://localhost:53000/swagger/index.html | ||||||
|
||||||
![SwaggerAPI](../images/l3af-on-windows/SwaggerAPI.png) | ||||||
|
||||||
### Attaching eBPF program with L3AF: | ||||||
|
||||||
> **NOTE:** Before moving further, set up [eBPF for Windows](https://github.com/microsoft/ebpf-for-windows/blob/main/docs/GettingStarted.md) on the system. | ||||||
|
||||||
#### Changes need to be done before proceeding: | ||||||
|
||||||
Manually set the following paths in [l3afd_win.cfg](../config/l3afd_win.cfg): | ||||||
- bpf-dir: | ||||||
- bpf-log-dir: | ||||||
- BpfMapDefaultPath: | ||||||
- [ebpf-repo] url: | ||||||
- set bpf-chaining-enabled to false | ||||||
|
||||||
#### Using [payload.json](./cfg/port_quota_add_payload.json) to load programs: | ||||||
|
||||||
- Use this curl command to add an eBPF program using the `payload.json` file: | ||||||
```bash | ||||||
curl -X POST http://localhost:53000/l3af/configs/v1/add -d "@cfg/payload.json" | ||||||
``` | ||||||
|
||||||
- See the `logs` in the window where `l3afd.exe` is running: | ||||||
|
||||||
![ebppAddProgramLog](../images/l3af-on-windows/ebppAddProgramLog.png) | ||||||
|
||||||
### Confirm eBPF program loading on Windows: | ||||||
|
||||||
- Use this command to list all the eBPF programs running on the system: | ||||||
```bash | ||||||
netsh ebpf show programs | ||||||
``` | ||||||
or | ||||||
```bash | ||||||
bpftool prog show | ||||||
``` | ||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert?