Created
August 3, 2012 08:02
-
-
Save mjf/3245634 to your computer and use it in GitHub Desktop.
Add IPv6 default route to the output of sipcalc(1)
This file contains hidden or 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
#! /usr/bin/awk -f | |
# Add IPv6 default route to the output of sipcalc(1) | |
# Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
# | |
# Assumes last usable IPv6 address as default route. | |
# | |
# Usage: sipcalc <net>[/<mask>] | sipcalc-add-ipv6-default-route.awk | |
/^Network range/ { | |
route = $4 | |
} | |
! $1 { | |
if (seen_blank) | |
next | |
seen_blank = 1 | |
} | |
/^-$/ { | |
printf("Default route (gateway)\t- %s\n", | |
substr(route, 1, length(route) - 1) "1") | |
} | |
{ print } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment