Skip to content

Commit d851b2f

Browse files
committed
snapcraft: Add FPM module with command to set mode or disable it
- New snap command: frr.set fpm {disable | protobuf | netlink} Signed-off-by: Martin Winter <[email protected]>
1 parent 80b4df3 commit d851b2f

File tree

5 files changed

+68
-2
lines changed

5 files changed

+68
-2
lines changed

snapcraft/README.usage.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Commands defined by this snap
3030
options
3131
- `frr.readme`:
3232
Returns this document `cat README_usage.md`
33+
- `frr.set`:
34+
Allows to enable `FPM` module. See FPM section below
3335

3436
and for debugging defined at this time (May get removed later - do not
3537
depend on them). These are mainly intended to debug the Snap
@@ -86,6 +88,20 @@ are named `eth0`, `eth1` and `eth2`, then the additional lines in
8688
These settings require either a reboot or a manual configuration with
8789
`sysctl` as well.
8890

91+
FPM Module
92+
----------
93+
The `frr.set` allows to turn FPM module on or off.
94+
95+
frr.set fpm {disable|protobuf|netlink}
96+
97+
Disables FPM or enables FPM with selected mode
98+
99+
By default, the FPM module is disabled, but installed with netlink and
100+
protobuf support. To enable the FPM module, use the `frr.set fpm protobuf`
101+
or `frr.set fpm netlink` command. The command will only enable the mode
102+
for the next restart of zebra. Please reboot or restart zebra after
103+
changing the mode to become effective.
104+
89105
FAQ
90106
---
91107
- frr.vtysh displays `--MORE--` on long output. How to suppress this?

snapcraft/scripts/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ install:
1212
install -D -m 0755 pimd-service $(DESTDIR)/bin/
1313
install -D -m 0755 ldpd-service $(DESTDIR)/bin/
1414
install -D -m 0755 nhrpd-service $(DESTDIR)/bin/
15+
install -D -m 0755 set-options $(DESTDIR)/bin/

snapcraft/scripts/set-options

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
case $1 in
6+
fpm)
7+
case $2 in
8+
disable)
9+
rm -f $SNAP_DATA/fpm.conf
10+
echo "FPM module disabled. Please restart FRR"
11+
;;
12+
protobuf)
13+
echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
14+
echo "FPM enabled and set to protobuf mode. Please restart FRR"
15+
;;
16+
netlink)
17+
echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
18+
echo "FPM enabled and set to netlink mode. Please restart FRR"
19+
;;
20+
*)
21+
echo "Usage:"
22+
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
23+
echo ""
24+
echo " Disables FPM module or enables it with specified mode"
25+
echo " Mode will be saved for next restart of zebra, but zebra"
26+
echo " is not automatically restarted"
27+
exit 1
28+
;;
29+
esac
30+
;;
31+
*)
32+
echo "Usage:"
33+
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
34+
echo ""
35+
echo " Disables FPM or enables FPM with selected mode"
36+
exit 1
37+
;;
38+
esac
39+
40+
exit 0

snapcraft/scripts/zebra-service

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ fi
88
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
99
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
1010
fi
11+
EXTRA_OPTIONS=""
12+
if [ -e $SNAP_DATA/fpm.conf ]; then
13+
EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`"
14+
fi
1115
exec $SNAP/sbin/zebra \
1216
-f $SNAP_DATA/zebra.conf \
1317
--pid_file $SNAP_DATA/zebra.pid \
1418
--socket $SNAP_DATA/zsock \
15-
--vty_socket $SNAP_DATA
16-
19+
--vty_socket $SNAP_DATA \
20+
--moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS

snapcraft/snapcraft.yaml.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ apps:
9090
- network
9191
- network-bind
9292
- network-control
93+
set:
94+
command: bin/set-options
9395
zebra-debug:
9496
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
9597
plugs:
@@ -177,6 +179,7 @@ parts:
177179
- bison
178180
- flex
179181
- python3-dev
182+
- protobuf-c-compiler
180183
stage-packages:
181184
- coreutils
182185
- iproute2
@@ -208,6 +211,8 @@ parts:
208211
- --enable-group=root
209212
- --enable-pimd
210213
- --enable-ldpd
214+
- --enable-fpm
215+
- --enable-protobuf
211216
- --enable-configfile-mask=0640
212217
- --enable-logfile-mask=0640
213218
- --localstatedir=/var/run

0 commit comments

Comments
 (0)