server/admin.c: Remove spurious `ping' in usage message.
[tripe] / contrib / ipif-peers.in
1 #! /bin/sh
2 ###
3 ### Start up peers registered in tripe-ipif's table
4 ###
5 ### (c) 2012 Mark Wooding
6 ###
7
8 ###----- Licensing notice ---------------------------------------------------
9 ###
10 ### This file is part of Trivial IP Encryption (TrIPE).
11 ###
12 ### TrIPE is free software: you can redistribute it and/or modify it under
13 ### the terms of the GNU General Public License as published by the Free
14 ### Software Foundation; either version 3 of the License, or (at your
15 ### option) any later version.
16 ###
17 ### TrIPE is distributed in the hope that it will be useful, but WITHOUT
18 ### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 ### for more details.
21 ###
22 ### You should have received a copy of the GNU General Public License
23 ### along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
24
25 ###--------------------------------------------------------------------------
26 ### Instructions.
27 ###
28 ### This script will tell a tripe server to associate with all of the peers
29 ### named in the $TRIPEDIR/ipif.tab file. See `tripe-ipif' for a description
30 ### of the configuration file.
31
32 set -e
33 quis=${0##*/}
34 : ${TRIPEDIR=@configdir@}
35
36 ## Trundle through the table.
37 while read name remote_ext local_int remote_int routes; do
38
39 ## Ignore comments, and unknown remote-external addresses.
40 case "$name" in "" | "#"*) continue ;; esac
41 case "$remote_ext" in -) continue ;; esac
42
43 ## Parse the address.
44 fam=INET port=4070
45 case "$remote_ext" in
46 *:*) port=${remote_ext#*:}; addr=${remote_ext%:*} ;;
47 *) addr=$remote_ext ;
48 esac
49
50 ## Add the peer.
51 tripectl ADD "$name" "$fam" "$addr" "$port"
52
53 done <$TRIPEDIR/ipif.tab
54
55 ###----- That's all, folks --------------------------------------------------