-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Make installation prefixes more realistic #36
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
## Fedora Demo VM | ||
|
||
Before running the script, ensure that virt-install is available on the system. | ||
|
||
`./build_bpf_demo.sh -n bpf-demo -k bpf_demo.ks.erb` | ||
|
||
After setting up the initial VM, log in (the default password is 'iovisor') | ||
and determine the DHCP IP. SSH to this IP as root. | ||
|
||
To set up a kernel with the right options, run `bpf-kernel-setup`. | ||
|
||
``` | ||
[root@bpf-demo ~]# bpf-kernel-setup | ||
Cloning into 'net-next'... | ||
``` | ||
After pulling the net-next branch, the kernel config menu should pop up. Ensure | ||
that the below settings are proper. | ||
``` | ||
General setup ---> | ||
[*] Enable bpf() system call | ||
Networking support ---> | ||
Networking options ---> | ||
QoS and/or fair queueing ---> | ||
<M> BPF-based classifier | ||
<M> BPF based action | ||
[*] enable BPF Just In Time compiler | ||
``` | ||
Once the .config is saved, the build will proceed and install the resulting | ||
kernel. This kernel has updated userspace headers (e.g. the bpf() syscall) which | ||
install into /usr/local/include...proper packaging for this will be | ||
distro-dependent. | ||
|
||
Next, run `bpf-llvm-setup` to pull and compile LLVM with BPF support enabled. | ||
``` | ||
[root@bpf-demo ~]# bpf-llvm-setup | ||
Cloning into 'llvm'... | ||
``` | ||
The resulting libraries will be installed into /opt/local/llvm. | ||
|
||
Next, reboot into the new kernel, either manually or by using the kexec helper. | ||
``` | ||
[root@bpf-demo ~]# kexec-4.1.0-rc1+ | ||
Connection to 192.168.122.247 closed by remote host. | ||
Connection to 192.168.122.247 closed. | ||
``` | ||
|
||
Reconnect and run the final step, building and testing bcc. | ||
``` | ||
[root@bpf-demo ~]# bcc-setup | ||
Cloning into 'bcc'... | ||
... | ||
Linking CXX shared library libbpfprog.so | ||
[100%] Built target bpfprog | ||
... | ||
Running tests... | ||
Test project /root/bcc/build | ||
Start 1: py_test1 | ||
1/4 Test #1: py_test1 ......................... Passed 0.24 sec | ||
Start 2: py_test2 | ||
2/4 Test #2: py_test2 ......................... Passed 0.53 sec | ||
Start 3: py_trace1 | ||
3/4 Test #3: py_trace1 ........................ Passed 0.09 sec | ||
Start 4: py_trace2 | ||
4/4 Test #4: py_trace2 ........................ Passed 1.06 sec | ||
|
||
100% tests passed, 0 tests failed out of 4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2015 PLUMgrid, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
struct ethernet_t { | ||
unsigned long long dst:48; | ||
unsigned long long src:48; | ||
unsigned int type:16; | ||
} __attribute__((packed)); | ||
|
||
struct dot1q_t { | ||
unsigned short pri:3; | ||
unsigned short cfi:1; | ||
unsigned short vlanid:12; | ||
unsigned short type; | ||
} __attribute__((packed)); | ||
|
||
struct arp_t { | ||
unsigned short htype; | ||
unsigned short ptype; | ||
unsigned char hlen; | ||
unsigned char plen; | ||
unsigned short oper; | ||
unsigned long long sha:48; | ||
unsigned long long spa:32; | ||
unsigned long long tha:48; | ||
unsigned int tpa; | ||
} __attribute__((packed)); | ||
|
||
struct ip_t { | ||
unsigned char ver:4; // byte 0 | ||
unsigned char hlen:4; | ||
unsigned char tos; | ||
unsigned short tlen; | ||
unsigned short identification; // byte 4 | ||
unsigned short ffo_unused:1; | ||
unsigned short df:1; | ||
unsigned short mf:1; | ||
unsigned short foffset:13; | ||
unsigned char ttl; // byte 8 | ||
unsigned char nextp; | ||
unsigned short hchecksum; | ||
unsigned int src; // byte 12 | ||
unsigned int dst; // byte 16 | ||
} __attribute__((packed)); | ||
|
||
struct udp_t { | ||
unsigned short sport; | ||
unsigned short dport; | ||
unsigned short length; | ||
unsigned short crc; | ||
} __attribute__((packed)); | ||
|
||
struct tcp_t { | ||
unsigned short src_port; // byte 0 | ||
unsigned short dst_port; | ||
unsigned int seq_num; // byte 4 | ||
unsigned int ack_num; // byte 8 | ||
unsigned char offset:4; // byte 12 | ||
unsigned char reserved:4; | ||
unsigned char flag_cwr:1; | ||
unsigned char flag_ece:1; | ||
unsigned char flag_urg:1; | ||
unsigned char flag_ack:1; | ||
unsigned char flag_psh:1; | ||
unsigned char flag_rst:1; | ||
unsigned char flag_syn:1; | ||
unsigned char flag_fin:1; | ||
unsigned short rcv_wnd; | ||
unsigned short cksum; // byte 16 | ||
unsigned short urg_ptr; | ||
} __attribute__((packed)); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
experimental line can be dropped :)