Skip to content

Commit

Permalink
[package] owipcalc: add "prefix" operation to set prefix of base addr…
Browse files Browse the repository at this point in the history
…ess during calculation

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32782 3c298f89-4303-0410-b956-a3cf2f4a3e73
  • Loading branch information
jow committed Jul 19, 2012
1 parent b27981b commit ec42626
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package/owipcalc/Makefile
Expand Up @@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=owipcalc
PKG_RELEASE:=1
PKG_RELEASE:=2

include $(INCLUDE_DIR)/package.mk

Expand Down
11 changes: 11 additions & 0 deletions package/owipcalc/src/owipcalc.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 },
Expand Down

0 comments on commit ec42626

Please sign in to comment.