forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make installation prefixes more realistic
* Add/document cmake variables that control various installation path options. See README.md for examples. * Updated README a bit * Hide helpers.h from include requirements * Install things to real paths in a proper way. Header files will go into <prefix>/share/bcc/include. * Move the kickstart script readme to its own directory. Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
- Loading branch information
Brenden Blanco
committed
Jun 10, 2015
1 parent
c765d24
commit 8310291
Showing
17 changed files
with
226 additions
and
166 deletions.
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 | ||
* | ||
* http://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.