summaryrefslogtreecommitdiffstats
path: root/package/owipcalc/src
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-07-19 19:51:53 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-07-19 19:51:53 +0000
commitec42626609ab22352d611d7dd5286e8b7249fcd0 (patch)
tree7b6c89d10efaa9ff257196154b6b71ee6a341db2 /package/owipcalc/src
parentb27981b0f9765c27c76e9fa18410766922f67066 (diff)
[package] owipcalc: add "prefix" operation to set prefix of base address during calculation
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32782 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/owipcalc/src')
-rw-r--r--package/owipcalc/src/owipcalc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/package/owipcalc/src/owipcalc.c b/package/owipcalc/src/owipcalc.c
index 6d7a8aaf4..06d163e2f 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 },