aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-07-19 19:51:53 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-07-19 19:51:53 +0000
commit3107a0954814b29b27d34babbd53ec1db4d507bc (patch)
tree5f53a8ab3f6fc79dca14f5ae02df595416934496 /package
parent7b778aba7ca89f5aee4a24ca8deb2d7a05c09b8a (diff)
downloadupstream-3107a0954814b29b27d34babbd53ec1db4d507bc.tar.gz
upstream-3107a0954814b29b27d34babbd53ec1db4d507bc.tar.bz2
upstream-3107a0954814b29b27d34babbd53ec1db4d507bc.zip
owipcalc: add "prefix" operation to set prefix of base address during calculation
SVN-Revision: 32782
Diffstat (limited to 'package')
-rw-r--r--package/owipcalc/Makefile2
-rw-r--r--package/owipcalc/src/owipcalc.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/package/owipcalc/Makefile b/package/owipcalc/Makefile
index 9ff9b24c2c..ec65c84c96 100644
--- a/package/owipcalc/Makefile
+++ b/package/owipcalc/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=owipcalc
-PKG_RELEASE:=1
+PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk
diff --git a/package/owipcalc/src/owipcalc.c b/package/owipcalc/src/owipcalc.c
index 6d7a8aaf43..06d163e2f8 100644
--- a/package/owipcalc/src/owipcalc.c
+++ b/package/owipcalc/src/owipcalc.c
@@ -518,6 +518,12 @@ static bool cidr_howmany(struct cidr *a, struct cidr *b)
return true;
}
+static bool cidr_prefix(struct cidr *a, struct cidr *b)
+{
+ a->prefix = b->prefix;
+ return true;
+}
+
static bool cidr_quiet(struct cidr *a)
{
quiet = true;
@@ -545,6 +551,11 @@ struct op ops[] = {
.desc = "Turn base address into broadcast address",
.f4.a1 = cidr_broadcast4 },
+ { .name = "prefix",
+ .desc = "Set the prefix of base address to argument",
+ .f4.a2 = cidr_prefix,
+ .f6.a2 = cidr_prefix },
+
{ .name = "netmask",
.desc = "Print netmask of base address, does not change base address",
.f4.a1 = cidr_netmask4 },