Commit | Line | Data |
---|---|---|
a4f886c3 MW |
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 | |
13 | ### it under the terms of the GNU General Public License as published by | |
14 | ### the Free Software Foundation; either version 2 of the License, or | |
15 | ### (at your option) any later version. | |
16 | ### | |
17 | ### TrIPE is distributed in the hope that it will be useful, | |
18 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ### GNU General Public License for more details. | |
21 | ### | |
22 | ### You should have received a copy of the GNU General Public License | |
23 | ### along with TrIPE; if not, write to the Free Software Foundation, | |
24 | ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
25 | ||
26 | ###-------------------------------------------------------------------------- | |
27 | ### Instructions. | |
28 | ### | |
29 | ### This script will tell a tripe server to associate with all of the peers | |
30 | ### named in the $TRIPEDIR/ipif.tab file. See `tripe-ipif' for a description | |
31 | ### of the configuration file. | |
32 | ||
33 | set -e | |
34 | quis=${0##*/} | |
01c94fa1 | 35 | : ${TRIPEDIR=@configdir@} |
a4f886c3 MW |
36 | |
37 | ## Trundle through the table. | |
38 | while read name remote_ext local_int remote_int routes; do | |
39 | ||
40 | ## Ignore comments, and unknown remote-external addresses. | |
41 | case "$name" in "" | "#"*) continue ;; esac | |
42 | case "$remote_ext" in -) continue ;; esac | |
43 | ||
44 | ## Parse the address. | |
45 | fam=INET port=4070 | |
46 | case "$remote_ext" in | |
47 | *:*) port=${remote_ext#*:}; addr=${remote_ext%:*} ;; | |
48 | *) addr=$remote_ext ; | |
49 | esac | |
50 | ||
51 | ## Add the peer. | |
52 | tripectl ADD "$name" "$fam" "$addr" "$port" | |
53 | ||
54 | done <$TRIPEDIR/ipif.tab | |
55 | ||
56 | ###----- That's all, folks -------------------------------------------------- |