Skip to content

Commit

Permalink
Build: fix usage of sudo during build
Browse files Browse the repository at this point in the history
  • Loading branch information
rixed committed Nov 22, 2022
1 parent e5f6885 commit 10ac2cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion META
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description = "poor man's network simulator"
version = "1"
version = "1.0.1"
requires = "findlib bitstring bitstring.ppx batteries"
archive(byte) = "robinet.cma"
archive(native) = "robinet.cmxa"
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,18 @@ $(CLIB): $(C_SOURCES:.c=.o)

examples: $(EXAMPLES)
@if which setcap > /dev/null 2>&1 ; then \
echo "You should run:" ;\
for f in $(EXAMPLES); do \
sudo setcap cap_net_raw,cap_net_admin=eip $$f ;\
echo "sudo setcap cap_net_raw,cap_net_admin=eip $$f" ;\
done ;\
fi

robinet.top: $(ARCHIVE)
$(OCAMLMKTOP) $(WARNS) -o $@ -package "findlib $(REQUIRES)" $(ARCHIVE)
@if which setcap > /dev/null 2>&1 ; then \
sudo setcap cap_net_raw,cap_net_admin=eip $@ ;\
echo "You should run:" ;\
echo "sudo setcap cap_net_raw,cap_net_admin=eip $@" ;\
fi

clean-spec:
rm -f examples/*.cm[ioxa] examples/*.o $(EXAMPLES)

install:
ocamlfind install robinet *.cmi robinet.cmxa robinet.cma META

uninstall:
ocamlfind remove robinet

11 changes: 6 additions & 5 deletions examples/router_frenzy_set_bridge.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh

# Assuming router_frenzy is run with -s 10 to avoid 192.168.0.0/24:
sudo ip link add type veth
sudo ifconfig veth0 192.168.10.42 up
sudo ifconfig veth1 up

sudo ip route add 192.168.11.0/24 dev veth0 via 192.168.10.1
sudo ip route add 192.168.12.0/24 dev veth0 via 192.168.10.1
sudo ip route add 192.168.13.0/24 dev veth0 via 192.168.10.1
for i in `seq 11 30`; do
sudo ip route add 192.168.$i.0/24 dev veth0 via 192.168.10.1
done

# Once the target is known, assuming first router is 192.168.0.1:
#sudo ip route add $target/32 dev veth0 via 192.168.0.1
# Once the target is known, assuming first router is 192.168.10.1:
#sudo ip route add $target/32 dev veth0 via 192.168.10.1
2 changes: 1 addition & 1 deletion opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "1.0.0"
version: "1.0.1"
name: "robinet"
maintainer: "[email protected]"
authors: "[email protected]"
Expand Down

0 comments on commit 10ac2cd

Please sign in to comment.