summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2018-02-09 09:30:37 +0000
committerdlg <dlg@openbsd.org>2018-02-09 09:30:37 +0000
commit43ebaaf2b573288fd962fe7b50455a0512c618b0 (patch)
tree61d556a35dfff6e4f99fde42fc00234de95352b2 /sys
parentisolate calls to the rfc2822 parser and handling of "." in smtp_dataline() (diff)
downloadwireguard-openbsd-43ebaaf2b573288fd962fe7b50455a0512c618b0.tar.xz
wireguard-openbsd-43ebaaf2b573288fd962fe7b50455a0512c618b0.zip
use struct in_addr to represent an address.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c10
-rw-r--r--sys/net/if_ipe.c0
-rw-r--r--sys/net/if_ipe.h0
-rw-r--r--sys/net/if_mobileip.c46
-rw-r--r--sys/net/pfvar.h9
5 files changed, 39 insertions, 26 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index c788df82c08..89470799f25 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.539 2018/02/07 22:36:54 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.540 2018/02/09 09:30:37 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -2109,6 +2109,14 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
if ((error = suser(p, 0)) != 0)
break;
/* FALLTHROUGH */
+ case SIOCGETKALIVE:
+ case SIOCGLIFPHYADDR:
+ case SIOCGLIFPHYRTABLE:
+ case SIOCGLIFPHYTTL:
+ case SIOCGIFMEDIA:
+ case SIOCGVNETID:
+ case SIOCGIFPAIR:
+ case SIOCGIFPARENT:
default:
NET_LOCK();
error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
diff --git a/sys/net/if_ipe.c b/sys/net/if_ipe.c
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/sys/net/if_ipe.c
diff --git a/sys/net/if_ipe.h b/sys/net/if_ipe.h
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/sys/net/if_ipe.h
diff --git a/sys/net/if_mobileip.c b/sys/net/if_mobileip.c
index 38e740ab8b9..e0b13ee8ab2 100644
--- a/sys/net/if_mobileip.c
+++ b/sys/net/if_mobileip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mobileip.c,v 1.4 2018/02/08 21:55:34 dlg Exp $ */
+/* $OpenBSD: if_mobileip.c,v 1.5 2018/02/09 09:30:37 dlg Exp $ */
/*
* Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
@@ -56,8 +56,8 @@ struct mobileip_softc {
sc_entry;
unsigned int sc_rtableid;
- uint32_t sc_src;
- uint32_t sc_dst;
+ struct in_addr sc_src;
+ struct in_addr sc_dst;
};
static int mobileip_clone_create(struct if_clone *, int);
@@ -115,8 +115,8 @@ mobileip_clone_create(struct if_clone *ifc, int unit)
return (ENOMEM);
sc->sc_rtableid = 0;
- sc->sc_src = INADDR_ANY;
- sc->sc_dst = INADDR_ANY;
+ sc->sc_src.s_addr = INADDR_ANY;
+ sc->sc_dst.s_addr = INADDR_ANY;
snprintf(sc->sc_if.if_xname, sizeof sc->sc_if.if_xname, "%s%d",
ifc->ifc_name, unit);
@@ -181,14 +181,14 @@ mobileip_cksum(const void *buf, size_t len)
static inline int
mobileip_cmp(const struct mobileip_softc *a, const struct mobileip_softc *b)
{
- if (a->sc_src > b->sc_src)
+ if (a->sc_src.s_addr > b->sc_src.s_addr)
return (1);
- if (a->sc_src < b->sc_src)
+ if (a->sc_src.s_addr < b->sc_src.s_addr)
return (-1);
- if (a->sc_dst > b->sc_dst)
+ if (a->sc_dst.s_addr > b->sc_dst.s_addr)
return (1);
- if (a->sc_dst < b->sc_dst)
+ if (a->sc_dst.s_addr < b->sc_dst.s_addr)
return (-1);
if (a->sc_rtableid > b->sc_rtableid)
@@ -288,7 +288,7 @@ mobileip_encap(struct mobileip_softc *sc, struct mbuf *m)
/* figure out how much extra space we'll need */
hlen = sizeof(*mh);
- if (ip->ip_src.s_addr != sc->sc_src)
+ if (ip->ip_src.s_addr != sc->sc_src.s_addr)
hlen += sizeof(*msh);
/* add the space */
@@ -313,20 +313,20 @@ mobileip_encap(struct mobileip_softc *sc, struct mbuf *m)
mh->mip_hcrc = 0;
mh->mip_dst = ip->ip_dst.s_addr;
- if (ip->ip_src.s_addr != sc->sc_src) {
+ if (ip->ip_src.s_addr != sc->sc_src.s_addr) {
mh->mip_flags |= MOBILEIP_SP;
msh = (struct mobileip_h_src *)(mh + 1);
msh->mip_src = ip->ip_src.s_addr;
- ip->ip_src.s_addr = sc->sc_src;
+ ip->ip_src.s_addr = sc->sc_src.s_addr;
}
htobem16(&mh->mip_hcrc, mobileip_cksum(mh, hlen));
ip->ip_p = IPPROTO_MOBILE;
htobem16(&ip->ip_len, bemtoh16(&ip->ip_len) + hlen);
- ip->ip_dst.s_addr = sc->sc_dst;
+ ip->ip_dst = sc->sc_dst;
m->m_flags &= ~(M_BCAST|M_MCAST);
m->m_pkthdr.ph_rtableid = sc->sc_rtableid;
@@ -424,7 +424,7 @@ mobileip_up(struct mobileip_softc *sc)
{
struct mobileip_softc *osc;
- if (sc->sc_dst == INADDR_ANY)
+ if (sc->sc_dst.s_addr == INADDR_ANY)
return (EDESTADDRREQ);
NET_ASSERT_LOCKED();
@@ -475,8 +475,8 @@ mobileip_set_tunnel(struct mobileip_softc *sc, struct if_laddrreq *req)
return (EINVAL);
/* commit */
- sc->sc_src = src->sin_addr.s_addr;
- sc->sc_dst = dst->sin_addr.s_addr;
+ sc->sc_src = src->sin_addr;
+ sc->sc_dst = dst->sin_addr;
return (0);
}
@@ -487,18 +487,18 @@ mobileip_get_tunnel(struct mobileip_softc *sc, struct if_laddrreq *req)
struct sockaddr_in *src = (struct sockaddr_in *)&req->addr;
struct sockaddr_in *dst = (struct sockaddr_in *)&req->dstaddr;
- if (sc->sc_dst == INADDR_ANY)
+ if (sc->sc_dst.s_addr == INADDR_ANY)
return (EADDRNOTAVAIL);
memset(src, 0, sizeof(*src));
src->sin_family = AF_INET;
src->sin_len = sizeof(*src);
- src->sin_addr.s_addr = sc->sc_src;
+ src->sin_addr = sc->sc_src;
memset(dst, 0, sizeof(*dst));
dst->sin_family = AF_INET;
dst->sin_len = sizeof(*dst);
- dst->sin_addr.s_addr = sc->sc_dst;
+ dst->sin_addr = sc->sc_dst;
return (0);
}
@@ -510,8 +510,8 @@ mobileip_del_tunnel(struct mobileip_softc *sc)
return (EBUSY);
/* commit */
- sc->sc_src = INADDR_ANY;
- sc->sc_dst = INADDR_ANY;
+ sc->sc_src.s_addr = INADDR_ANY;
+ sc->sc_dst.s_addr = INADDR_ANY;
return (0);
}
@@ -536,8 +536,8 @@ mobileip_input(struct mbuf **mp, int *offp, int type, int af)
ip = mtod(m, struct ip *);
key.sc_rtableid = m->m_pkthdr.ph_rtableid;
- key.sc_src = ip->ip_dst.s_addr;
- key.sc_dst = ip->ip_src.s_addr;
+ key.sc_src = ip->ip_dst;
+ key.sc_dst = ip->ip_src;
/* NET_ASSERT_READ_LOCKED() */
sc = RBT_FIND(mobileip_tree, &mobileip_softcs, &key);
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index fb245426ef4..360d21ad2ca 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.474 2018/02/08 09:15:46 henning Exp $ */
+/* $OpenBSD: pfvar.h,v 1.475 2018/02/09 09:30:37 dlg Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -49,6 +49,10 @@ struct ip;
struct ip6_hdr;
struct mbuf_list;
+/* sub protocol types */
+#define IPPROTO_GRE_V0 0
+#define IPPROTO_GRE_PPTP 1
+
#define PF_TCPS_PROXY_SRC ((TCP_NSTATES)+0)
#define PF_TCPS_PROXY_DST ((TCP_NSTATES)+1)
@@ -585,7 +589,8 @@ struct pf_rule {
u_int8_t set_prio[2];
sa_family_t naf;
u_int8_t rcvifnot;
- u_int8_t pad[2];
+ u_int8_t subproto;
+ u_int8_t pad[1];
struct {
struct pf_addr addr;