Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh04-02 committed Aug 6, 2019
2 parents 2120f00 + e81b691 commit 25d69fd
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 32 deletions.
4 changes: 3 additions & 1 deletion include/ip_subnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ ip_address subnet_floor(const ip_subnet *subnet);
/* PREFIX|~MASK; aka IPv4 broadcast but not IPv6 */
ip_address subnet_ceiling(const ip_subnet *subnet);

/* PREFIX|HOST:PORT */
ip_endpoint subnet_endpoint(const ip_subnet *subnet);

/*
* old
*/
Expand All @@ -88,7 +91,6 @@ extern err_t addrtosubnet(const ip_address *addr, ip_subnet *dst);
extern err_t rangetosubnet(const ip_address *from, const ip_address *to,
ip_subnet *dst);
extern int subnettypeof(const ip_subnet *src);
extern void networkof(const ip_subnet *src, ip_address *dst);

/* tests */
extern bool samesubnet(const ip_subnet *a, const ip_subnet *b);
Expand Down
5 changes: 5 additions & 0 deletions lib/libswan/ip_subnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#include "libreswan/passert.h"
#include "lswlog.h" /* for pexpect() */

ip_endpoint subnet_endpoint(const ip_subnet *src)
{
return src->addr;
}

const struct ip_info *subnet_info(const ip_subnet * src)
{
return address_info(&src->addr);
Expand Down
10 changes: 0 additions & 10 deletions lib/libswan/subnettypeof.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ const ip_subnet * src;
return src->addr.u.v4.sin_family;
}

/*
* networkof - get the network address of a subnet
*/
void networkof(src, dst)
const ip_subnet * src;
ip_address *dst;
{
*dst = src->addr;
}

/*
* masktocount - convert a mask, expressed as an address, to a bit count
*/
Expand Down
10 changes: 5 additions & 5 deletions mk/kvm-targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#
# Pull in all its defaults so that they override everything below.

KVM_OS ?= fedora28
include testing/libvirt/$(KVM_OS).mk
KVM_GUEST_OS ?= fedora28
include testing/libvirt/$(KVM_GUEST_OS).mk


#
Expand Down Expand Up @@ -112,14 +112,14 @@ VIRT_SECURITY ?= --security type=static,model=dac,label='$(KVM_UID):$(KVM_GID)',
VIRT_GATEWAY ?= --network=network:$(KVM_GATEWAY),model=virtio
VIRT_SOURCEDIR ?= --filesystem type=mount,accessmode=squash,source=$(KVM_SOURCEDIR),target=swansource
VIRT_TESTINGDIR ?= --filesystem type=mount,accessmode=squash,source=$(KVM_TESTINGDIR),target=testing
KVM_OS_VARIANT ?= $(KVM_OS)
KVM_OS_VARIANT ?= $(KVM_GUEST_OS)
VIRT_OS_VARIANT ?= --os-variant $(KVM_OS_VARIANT)

#
# Hosts
#

KVM_BASE_HOST = swan$(KVM_OS)base
KVM_BASE_HOST = swan$(KVM_GUEST_OS)base

KVM_BUILD_HOST = build
KVM_BUILD_HOST_CLONES = $(filter-out $(KVM_BASIC_HOSTS), $(KVM_TEST_HOSTS))
Expand Down Expand Up @@ -1094,7 +1094,7 @@ Configuration:
the shared NATting gateway;
used by the base (master) domain along with any local domains
when internet access is required
$(call kvm-var-value,KVM_OS)
$(call kvm-var-value,KVM_GUEST_OS)
$(call kvm-var-value,KVM_KICKSTART_FILE)
$(call kvm-var-value,KVM_GATEWAY)
$(call kvm-var-value,KVM_BASE_HOST)
Expand Down
4 changes: 2 additions & 2 deletions programs/eroute/eroute.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ int main(int argc, char **argv)
case EMT_INEROUTE:
case EMT_INREPLACEROUTE:
case EMT_DELEROUTE:
networkof(&s_subnet, &pfkey_address_sflow_ska); /* src flow */
pfkey_address_sflow_ska = subnet_endpoint(&s_subnet); /* src flow */
add_port(eroute_af, &pfkey_address_sflow_ska, src_port);
error = pfkey_address_build(
&extensions[SADB_X_EXT_ADDRESS_SRC_FLOW],
Expand All @@ -777,7 +777,7 @@ int main(int argc, char **argv)
progname);
}

networkof(&d_subnet, &pfkey_address_dflow_ska); /* dst flow */
pfkey_address_dflow_ska = subnet_endpoint(&d_subnet); /* dst flow */
add_port(eroute_af, &pfkey_address_dflow_ska, dst_port);
error = pfkey_address_build(
&extensions[SADB_X_EXT_ADDRESS_DST_FLOW],
Expand Down
5 changes: 3 additions & 2 deletions programs/ipsec/ipsec.in
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,9 @@ ipsec_checknss() {
echo "Failed to initialize nss database ${IPSEC_NSSDIR_SQL}" >&2
exit 4
fi
if [ -x "$(which restorecon)" ]; then
restorecon -Rv "${IPSEC_NSSDIR}"
restorecon="$(which restorecon 2>/dev/null)"
if [ -n "${restorecon}" -a -x "${restorecon}" ]; then
"${restorecon}" -Rv "${IPSEC_NSSDIR}"
fi
exit 0
else
Expand Down
2 changes: 1 addition & 1 deletion programs/pluto/connections.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ size_t format_end(char *buf,
if (this->has_client) {
ip_address client_net, client_mask;

networkof(&this->client, &client_net);
client_net = subnet_endpoint(&this->client);
client_mask = subnet_mask(&this->client);
client_sep = "===";

Expand Down
4 changes: 2 additions & 2 deletions programs/pluto/foodgroups.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ static int subnetcmp(const ip_subnet *a, const ip_subnet *b)
ip_address neta, netb;
int r;

networkof(a, &neta);
neta = subnet_endpoint(a);
ip_address maska = subnet_mask(a);
networkof(b, &netb);
netb = subnet_endpoint(b);
ip_address maskb = subnet_mask(b);
r = addrcmp(&neta, &netb);
if (r == 0)
Expand Down
2 changes: 1 addition & 1 deletion programs/pluto/ikev1_quick.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static bool emit_subnet_id(const ip_subnet *net,
return FALSE;

ip_address ta;
networkof(net, &ta);
ta = subnet_endpoint(net);
const unsigned char *tbp;
size_t tal = addrbytesptr_read(&ta, &tbp);
if (!out_raw(tbp, tal, &id_pbs, "client network"))
Expand Down
8 changes: 4 additions & 4 deletions programs/pluto/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ void record_and_initiate_opportunistic(const ip_subnet *ours,

ip_address src, dst;

networkof(ours, &src);
networkof(his, &dst);
src = subnet_endpoint(ours);
dst = subnet_endpoint(his);

/* This check should not be needed :( */
if (has_bare_hold(&src, &dst, transport_proto)) {
Expand Down Expand Up @@ -429,7 +429,7 @@ static void jam_common_shell_out(jambuf_t *buf, const struct connection *c,

jam(buf, "PLUTO_MY_CLIENT_NET='");
ip_address ta;
networkof(&sr->this.client, &ta);
ta = subnet_endpoint(&sr->this.client);
jam_address(buf, &ta);
jam(buf, "' ");

Expand Down Expand Up @@ -464,7 +464,7 @@ static void jam_common_shell_out(jambuf_t *buf, const struct connection *c,
jam(buf, "' ");

jam(buf, "PLUTO_PEER_CLIENT_NET='");
networkof(&sr->that.client, &ta);
ta = subnet_endpoint(&sr->that.client);
jam_address(buf, &ta);
jam(buf, "' ");

Expand Down
8 changes: 4 additions & 4 deletions programs/pluto/kernel_pfkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,11 +935,11 @@ bool pfkey_raw_eroute(const ip_address *this_host,
int dport = ntohs(portof(&that_client->addr));
int satype;

networkof(this_client, &sflow_ska);
sflow_ska = subnet_endpoint(this_client);
smask_ska = subnet_mask(this_client);
setportof(sport ? ~0 : 0, &smask_ska);

networkof(that_client, &dflow_ska);
dflow_ska = subnet_endpoint(that_client);
dmask_ska = subnet_mask(that_client);
setportof(dport ? ~0 : 0, &dmask_ska);

Expand Down Expand Up @@ -1794,8 +1794,8 @@ void pfkey_scan_shunts(void)
struct eroute_info *p = expired;
ip_address src, dst;

networkof(&p->ours, &src);
networkof(&p->his, &dst);
src = subnet_endpoint(&p->ours);
dst = subnet_endpoint(&p->his);

if (delete_bare_shunt(&src, &dst,
p->transport_proto, SPI_HOLD, /* what spi to use? */
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 25d69fd

Please sign in to comment.