owipcalc: add "prefix" operation to set prefix of base address during calculation
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 19 Jul 2012 19:51:53 +0000 (19:51 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 19 Jul 2012 19:51:53 +0000 (19:51 +0000)
SVN-Revision: 32782

package/owipcalc/Makefile
package/owipcalc/src/owipcalc.c

index 9ff9b24c2c2e7da32404a6768e450d71df46a99c..ec65c84c96b2228838cb98c8e7f354ea23c2e700 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=owipcalc
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 include $(INCLUDE_DIR)/package.mk
 
index 6d7a8aaf43870203210890b43ab76cd2199d33aa..06d163e2f87f0bb98f7ea88f17f1403a84e2aae6 100644 (file)
@@ -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 },