diff --git a/.gitignore b/.gitignore index 144d7e987..81a6553ed 100644 --- a/.gitignore +++ b/.gitignore @@ -20,16 +20,3 @@ lib/machine_include/ lib/vnode_if.h lib/vnode_if_newproto.h lib/vnode_if_typedef.h -app/nginx-1.11.10/Makefile -app/nginx-1.11.10/objs/ -tools/arp/arp -tools/ifconfig/ifconfig -tools/ipfw/ipfw -tools/netstat/netstat -tools/netstat/nl_defs.h -tools/netstat/nl_symbols.c -tools/ngctl/ngctl -tools/route/keywords.h -tools/route/route -tools/sysctl/sysctl -tools/top/top diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 000000000..6bc1295d4 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,6 @@ +netstat/nl_defs.h +netstat/nl_symbols.c +route/keywords.h +netstat/nl_defs.h +netstat/nl_symbols.c +route/keywords.h diff --git a/tools/README.md b/tools/README.md index 060340b4d..866cb4ac2 100644 --- a/tools/README.md +++ b/tools/README.md @@ -2,6 +2,8 @@ Directory `compat` implements an ipc library using dpdk `rte_ring` and ports some source files compatible with FreeBSD and Linux. +Directory `sbin` contains all the tools binary that compiled. + All other directories are useful tools ported from FreeBSD. Since F-Stack is multi-process architecture and every process has an independent stack, so we must communicate with every F-Stack process. Each tool add an option `-p`(Which F-Stack process to communicate with, default 0), except that, it is same with the original FreeBSD. @@ -48,38 +50,38 @@ Examples: ``` Add a default route: - ./route -p 0 add -net 0.0.0.0/0 192.168.1.1 + ./sbin/route -p 0 add -net 0.0.0.0/0 192.168.1.1 A shorter version of adding a default route can also be written as: - ./route -p 0 add default 192.168.1.1 + ./sbin/route -p 0 add default 192.168.1.1 Add a static route to the 172.16.10.0/24 network via the 172.16.1.1 gate- way: - ./route -p 0 add -net 172.16.10.0/24 172.16.1.1 + ./sbin/route -p 0 add -net 172.16.10.0/24 172.16.1.1 Change the gateway of an already established static route in the routing table: - ./route -p 0 change -net 172.16.10.0/24 172.16.1.2 + ./sbin/route -p 0 change -net 172.16.10.0/24 172.16.1.2 Display the route for a destination network: - ./route -p 0 show 172.16.10.0 + ./sbin/route -p 0 show 172.16.10.0 Delete a static route from the routing table: - ./route -p 0 delete -net 172.16.10.0/24 172.16.1.2 + ./sbin/route -p 0 delete -net 172.16.10.0/24 172.16.1.2 Remove all routes from the routing table: - ./route -p 0 flush + ./sbin/route -p 0 flush FreeBSD uses `netstat -rn ` to list the route table which we havn't ported, you can execute the following command instead, `-d` means debug mode, `-v` means verbose. - ./route -p 0 -d -v flush + ./sbin/route -p 0 -d -v flush ``` Note that, if you want to modify the route table, you must use `-p` to execute the same command for each f-stack process. @@ -92,7 +94,7 @@ top [-p ] [-d ] [-n num] ``` Examples: ``` -./tools/top/top +./sbin/top |---------|---------|---------|---------------| | idle| sys| usr| loop| @@ -219,7 +221,7 @@ traffic [-p ] [-d ] [-n num] ``` Examples: ``` -./tools/traffic/traffic +./sbin/traffic |--------------------|--------------------|--------------------|--------------------| | rx packets| rx bytes| tx packets| tx bytes| diff --git a/tools/prog.mk b/tools/prog.mk index 1c4f8e561..2eaa52f36 100644 --- a/tools/prog.mk +++ b/tools/prog.mk @@ -35,6 +35,8 @@ SRCS= ${PROG}.c endif endif +PROGDIR= ${TOPDIR}/tools/sbin + HEADERS+= $(filter %.h,${SRCS}) OBJS+= $(patsubst %.c,%.o, $(filter %.c,${SRCS})) OBJS+= $(patsubst %.cc,%.o, $(filter %.cc,${SRCS})) @@ -63,13 +65,13 @@ LIBS+= ${FF_PROG_LIBS} CFLAGS+= $(foreach n,${LIBADD},-I${TOPDIR}/tools/lib${n}) LIBS+= $(foreach n,${LIBADD},-L${TOPDIR}/tools/lib${n} -l${n}) -CLEANFILES+= ${PROG} ${OBJS} +CLEANFILES+= ${PROGDIR}/${PROG} ${OBJS} ${PROG}: ${HEADERS} ${OBJS} ifdef PROG_CXX - ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} + ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS} else - ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} + ${CC} ${CFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS} endif clean: diff --git a/tools/sbin/.gitignore b/tools/sbin/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/tools/sbin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore