-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates for the latest version of OpenBSD (6.8 as of this writing) as well as endian fixes and changes to the use of tunnels. Signed-off-by: Dan Cross <[email protected]>
- Loading branch information
Dan Cross
committed
Jan 5, 2021
1 parent
94ce425
commit 827fd9d
Showing
15 changed files
with
481 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,20 @@ | |
================================================== | ||
|
||
This is 44ripd, a daemon for maintaining routes and tunnels on the | ||
AMPRNet amateur radio IP network (IPv4 network 44/8). This software | ||
implements a listener for RIPv2 packets containing route and tunnel | ||
information for gateways to APMRNet sub-networks as well as support | ||
for maintaining routes and IPENCAP tunnels. It runs on OpenBSD, | ||
but is likely portable to other BSD variants with fairly little | ||
work. The author current runs it on a Ubiquiti Networks EdgeRouter | ||
Lite running OpenBSD/Octeon. The software is released under the | ||
2-clause BSD license. | ||
AMPRNet amateur radio IP network (IPv4 network 44/9 and 44.128.0.0/10). | ||
|
||
This software implements a listener for RIPv2 packets containing route | ||
and tunnel information for gateways to APMRNet sub-networks as well as | ||
support for maintaining routes and IPENCAP tunnels. It runs on OpenBSD, | ||
but is likely portable to other BSD variants with fairly little work. | ||
The author current runs it on a Ubiquiti Networks EdgeRouter Lite | ||
running OpenBSD/Octeon. | ||
|
||
The software is released under the 2-clause BSD license. | ||
|
||
Author | ||
------ | ||
44ripd was written by Dan Cross, AC2OI. Reach me via email at | ||
44ripd was written by Dan Cross, KZ2X. Reach me via email at | ||
[email protected] or find me on the web at http://pub.gajendra.net/ | ||
|
||
TODO | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* A program to manually add or remove tunnel routes. route(8) | ||
* is not sufficiently expressive to do this. | ||
*/ | ||
#include <sys/types.h> | ||
#include <sys/socket.h> | ||
#include <netinet/in.h> | ||
#include <netinet/ip.h> | ||
#include <netinet/udp.h> | ||
#include <arpa/inet.h> | ||
|
||
#include <assert.h> | ||
#include <stddef.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <time.h> | ||
#include <unistd.h> | ||
|
||
#include "dat.h" | ||
#include "fns.h" | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
Route route; | ||
Tunnel tunnel; | ||
struct in_addr addr; | ||
char *slash, *net, *ifname; | ||
unsigned int cidr; | ||
uint32_t netmask; | ||
int ch, rdomain; | ||
|
||
rdomain = 0; | ||
while ((ch = getopt(argc, argv, "D:?h")) != -1) { | ||
switch (ch) { | ||
case 'D': | ||
rdomain = strnum(optarg); | ||
break; | ||
case '?': | ||
case 'h': | ||
default: | ||
fatal("usage: amprroute network/cidr ifname"); | ||
break; | ||
} | ||
} | ||
argc -= optind; | ||
argv += optind; | ||
|
||
initlog(); | ||
initsys(rdomain); | ||
|
||
if (argc != 2) | ||
fatal("usage: amprroute network/cidr ifname"); | ||
net = argv[0]; | ||
ifname = argv[1]; | ||
|
||
slash = strchr(net, '/'); | ||
if (slash == NULL) | ||
fatal("network missing CIDR"); | ||
*slash++ = '\0'; | ||
cidr = strnum(slash); | ||
netmask = cidr2netmask(cidr); | ||
|
||
memset(&addr, 0, sizeof(addr)); | ||
if (inet_pton(AF_INET, net, &addr) <= 0) | ||
fatal("cannot parse network: %s", net); | ||
|
||
memset(&route, 0, sizeof(route)); | ||
route.subnetmask = netmask; | ||
route.ipnet = ntohl(addr.s_addr); | ||
|
||
memset(&tunnel, 0, sizeof(tunnel)); | ||
strlcpy(tunnel.ifname, ifname, sizeof(tunnel.ifname)); | ||
|
||
addroute(&route, &tunnel, rdomain); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.