summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/net
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-20 15:53:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:39 +0200
commit18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d (patch)
treea3020ac5b1f366f2f0920941b589808e435dbcee /freebsd/sys/net
parentUpdate to FreeBSD head 2017-12-01 (diff)
downloadrtems-libbsd-18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d.tar.bz2
Update to FreeBSD head 2018-02-01
Git mirror commit d079ae0442af8fa3cfd6d7ede190d04e64a2c0d4. Update #3472.
Diffstat (limited to 'freebsd/sys/net')
-rw-r--r--freebsd/sys/net/altq/altq_hfsc.h2
-rw-r--r--freebsd/sys/net/bpf.c11
-rw-r--r--freebsd/sys/net/ieee8023ad_lacp.c4
-rw-r--r--freebsd/sys/net/if_clone.c14
-rw-r--r--freebsd/sys/net/if_ethersubr.c2
-rw-r--r--freebsd/sys/net/if_gif.c2
-rw-r--r--freebsd/sys/net/if_lagg.c2
-rw-r--r--freebsd/sys/net/iflib.h12
-rw-r--r--freebsd/sys/net/pfvar.h1
-rw-r--r--freebsd/sys/net/route.c14
-rw-r--r--freebsd/sys/net/route.h13
-rw-r--r--freebsd/sys/net/rtsock.c22
-rw-r--r--freebsd/sys/net/sff8472.h12
13 files changed, 74 insertions, 37 deletions
diff --git a/freebsd/sys/net/altq/altq_hfsc.h b/freebsd/sys/net/altq/altq_hfsc.h
index de5e89b8..0a9fcf95 100644
--- a/freebsd/sys/net/altq/altq_hfsc.h
+++ b/freebsd/sys/net/altq/altq_hfsc.h
@@ -192,7 +192,7 @@ struct hfsc_class_stats {
* representation.
* the slope values are scaled to avoid overflow.
* the inverse slope values as well as the y-projection of the 1st
- * segment are kept in order to to avoid 64-bit divide operations
+ * segment are kept in order to avoid 64-bit divide operations
* that are expensive on 32-bit architectures.
*
* note: Intel Pentium TSC never wraps around in several thousands of years.
diff --git a/freebsd/sys/net/bpf.c b/freebsd/sys/net/bpf.c
index 6fc6b435..e6ad9e25 100644
--- a/freebsd/sys/net/bpf.c
+++ b/freebsd/sys/net/bpf.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sockio.h>
#include <sys/ttycom.h>
#include <sys/uio.h>
+#include <sys/sysent.h>
#include <sys/event.h>
#include <sys/file.h>
@@ -728,7 +729,7 @@ bpf_check_upgrade(u_long cmd, struct bpf_d *d, struct bpf_insn *fcode, int flen)
* Check if cmd looks like snaplen setting from
* pcap_bpf.c:pcap_open_live().
* Note we're not checking .k value here:
- * while pcap_open_live() definitely sets to to non-zero value,
+ * while pcap_open_live() definitely sets to non-zero value,
* we'd prefer to treat k=0 (deny ALL) case the same way: e.g.
* do not consider upgrading immediately
*/
@@ -1396,9 +1397,11 @@ bpfioctl(struct bpf_d *d, u_long cmd, caddr_t addr, int flags,
case BIOCGDLTLIST32:
case BIOCGRTIMEOUT32:
case BIOCSRTIMEOUT32:
- BPFD_LOCK(d);
- d->bd_compat32 = 1;
- BPFD_UNLOCK(d);
+ if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+ BPFD_LOCK(d);
+ d->bd_compat32 = 1;
+ BPFD_UNLOCK(d);
+ }
}
#endif
diff --git a/freebsd/sys/net/ieee8023ad_lacp.c b/freebsd/sys/net/ieee8023ad_lacp.c
index 1778193d..2a30f4a3 100644
--- a/freebsd/sys/net/ieee8023ad_lacp.c
+++ b/freebsd/sys/net/ieee8023ad_lacp.c
@@ -203,8 +203,8 @@ SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, debug, CTLFLAG_RWTUN | CTLFLAG_VNET,
&VNET_NAME(lacp_debug), 0, "Enable LACP debug logging (1=debug, 2=trace)");
static VNET_DEFINE(int, lacp_default_strict_mode) = 1;
-SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, default_strict_mode, CTLFLAG_RWTUN,
- &VNET_NAME(lacp_default_strict_mode), 0,
+SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, default_strict_mode,
+ CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(lacp_default_strict_mode), 0,
"LACP strict protocol compliance default");
#define LACP_DPRINTF(a) if (V_lacp_debug & 0x01) { lacp_dprintf a ; }
diff --git a/freebsd/sys/net/if_clone.c b/freebsd/sys/net/if_clone.c
index 99faa05f..295bddf4 100644
--- a/freebsd/sys/net/if_clone.c
+++ b/freebsd/sys/net/if_clone.c
@@ -357,7 +357,7 @@ if_clone_alloc(const char *name, int maxunit)
return (ifc);
}
-
+
static int
if_clone_attach(struct if_clone *ifc)
{
@@ -389,10 +389,8 @@ if_clone_advanced(const char *name, u_int maxunit, ifc_match_t match,
ifc->ifc_create = create;
ifc->ifc_destroy = destroy;
- if (if_clone_attach(ifc) != 0) {
- if_clone_free(ifc);
+ if (if_clone_attach(ifc) != 0)
return (NULL);
- }
EVENTHANDLER_INVOKE(if_clone_event, ifc);
@@ -412,10 +410,8 @@ if_clone_simple(const char *name, ifcs_create_t create, ifcs_destroy_t destroy,
ifc->ifcs_destroy = destroy;
ifc->ifcs_minifs = minifs;
- if (if_clone_attach(ifc) != 0) {
- if_clone_free(ifc);
+ if (if_clone_attach(ifc) != 0)
return (NULL);
- }
for (unit = 0; unit < minifs; unit++) {
char name[IFNAMSIZ];
@@ -452,7 +448,7 @@ if_clone_detach(struct if_clone *ifc)
/* destroy all interfaces for this cloner */
while (!LIST_EMPTY(&ifc->ifc_iflist))
if_clone_destroyif(ifc, LIST_FIRST(&ifc->ifc_iflist));
-
+
IF_CLONE_REMREF(ifc);
}
@@ -514,7 +510,7 @@ if_clone_list(struct if_clonereq *ifcr)
done:
IF_CLONERS_UNLOCK();
- if (err == 0)
+ if (err == 0 && dst != NULL)
err = copyout(outbuf, dst, buf_count*IFNAMSIZ);
if (outbuf != NULL)
free(outbuf, M_CLONE);
diff --git a/freebsd/sys/net/if_ethersubr.c b/freebsd/sys/net/if_ethersubr.c
index 9b927511..24f11436 100644
--- a/freebsd/sys/net/if_ethersubr.c
+++ b/freebsd/sys/net/if_ethersubr.c
@@ -292,7 +292,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
int hlen; /* link layer header length */
uint32_t pflags;
struct llentry *lle = NULL;
- struct rtentry *rt0 = NULL;
int addref = 0;
phdr = NULL;
@@ -322,7 +321,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
pflags = lle->r_flags;
}
}
- rt0 = ro->ro_rt;
}
#ifdef MAC
diff --git a/freebsd/sys/net/if_gif.c b/freebsd/sys/net/if_gif.c
index fdbccbb6..bd33ab75 100644
--- a/freebsd/sys/net/if_gif.c
+++ b/freebsd/sys/net/if_gif.c
@@ -526,7 +526,6 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn)
struct ip6_hdr *ip6;
uint32_t t;
#endif
- struct gif_softc *sc;
struct ether_header *eh;
struct ifnet *oldifp;
int isr, n, af;
@@ -536,7 +535,6 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn)
m_freem(m);
return;
}
- sc = ifp->if_softc;
m->m_pkthdr.rcvif = ifp;
m_clrprotoflags(m);
switch (proto) {
diff --git a/freebsd/sys/net/if_lagg.c b/freebsd/sys/net/if_lagg.c
index ce696fb2..36c8095a 100644
--- a/freebsd/sys/net/if_lagg.c
+++ b/freebsd/sys/net/if_lagg.c
@@ -246,7 +246,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, failover_rx_all, CTLFLAG_RW | CTLFLAG_VNET,
"Accept input from any interface in a failover lagg");
/* Default value for using flowid */
-static VNET_DEFINE(int, def_use_flowid) = 1;
+static VNET_DEFINE(int, def_use_flowid) = 0;
#define V_def_use_flowid VNET(def_use_flowid)
SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RWTUN,
&VNET_NAME(def_use_flowid), 0,
diff --git a/freebsd/sys/net/iflib.h b/freebsd/sys/net/iflib.h
index 70992fdd..3730f0ea 100644
--- a/freebsd/sys/net/iflib.h
+++ b/freebsd/sys/net/iflib.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org)
+ * Copyright (c) 2014-2017, Matthew Macy (mmacy@mattmacy.io)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -174,9 +174,9 @@ typedef struct pci_vendor_info {
#define PVID_END {0, 0, 0, 0, 0, 0, NULL}
#define IFLIB_PNP_DESCR "U32:vendor;U32:device;U32:subvendor;U32:subdevice;" \
- "U32:revision;U32:class;D:human"
+ "U32:revision;U32:class;D:#"
#define IFLIB_PNP_INFO(b, u, t) \
- MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, sizeof(t[0]), nitems(t))
+ MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, sizeof(t[0]), nitems(t) - 1)
typedef struct if_txrx {
int (*ift_txd_encap) (void *, if_pkt_info_t);
@@ -217,6 +217,8 @@ typedef struct if_softc_ctx {
iflib_intr_mode_t isc_intr;
uint16_t isc_max_frame_size; /* set at init time by driver */
+ uint16_t isc_min_frame_size; /* set at init time by driver, only used if
+ IFLIB_NEED_ETHER_PAD is set. */
uint32_t isc_pause_frames; /* set by driver for iflib_timer to detect */
pci_vendor_info_t isc_vendor_info; /* set by iflib prior to attach_pre */
int isc_disable_msix;
@@ -314,6 +316,10 @@ typedef enum {
* Driver needs csum zeroed for offloading
*/
#define IFLIB_NEED_ZERO_CSUM 0x80
+/*
+ * Driver needs frames padded to some minimum length
+ */
+#define IFLIB_NEED_ETHER_PAD 0x100
diff --git a/freebsd/sys/net/pfvar.h b/freebsd/sys/net/pfvar.h
index 4bc84d94..c9b1d1db 100644
--- a/freebsd/sys/net/pfvar.h
+++ b/freebsd/sys/net/pfvar.h
@@ -1619,6 +1619,7 @@ int pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *,
u_int32_t
pf_state_expires(const struct pf_state *);
void pf_purge_expired_fragments(void);
+void pf_purge_fragments(uint32_t);
int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *,
int);
int pf_socket_lookup(int, struct pf_pdesc *, struct mbuf *);
diff --git a/freebsd/sys/net/route.c b/freebsd/sys/net/route.c
index 1be39753..ade738a2 100644
--- a/freebsd/sys/net/route.c
+++ b/freebsd/sys/net/route.c
@@ -1765,6 +1765,8 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
int family, mtu;
struct if_mtuinfo ifmtu;
+ RIB_WLOCK_ASSERT(rnh);
+
rt = (struct rtentry *)rnh->rnh_lookup(info->rti_info[RTAX_DST],
info->rti_info[RTAX_NETMASK], &rnh->head);
@@ -1813,8 +1815,9 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
/* Check if outgoing interface has changed */
if (info->rti_ifa != NULL && info->rti_ifa != rt->rt_ifa &&
- rt->rt_ifa != NULL && rt->rt_ifa->ifa_rtrequest != NULL) {
- rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
+ rt->rt_ifa != NULL) {
+ if (rt->rt_ifa->ifa_rtrequest != NULL)
+ rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
ifa_free(rt->rt_ifa);
}
/* Update gateway address */
@@ -1854,6 +1857,13 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
}
}
+ /*
+ * This route change may have modified the route's gateway. In that
+ * case, any inpcbs that have cached this route need to invalidate their
+ * llentry cache.
+ */
+ rnh->rnh_gen++;
+
if (ret_nrt) {
*ret_nrt = rt;
RT_ADDREF(rt);
diff --git a/freebsd/sys/net/route.h b/freebsd/sys/net/route.h
index 8835433e..28f1db01 100644
--- a/freebsd/sys/net/route.h
+++ b/freebsd/sys/net/route.h
@@ -416,6 +416,14 @@ struct rt_addrinfo {
} \
} while (0)
+#define RO_INVALIDATE_CACHE(ro) do { \
+ RO_RTFREE(ro); \
+ if ((ro)->ro_lle != NULL) { \
+ LLE_FREE((ro)->ro_lle); \
+ (ro)->ro_lle = NULL; \
+ } \
+ } while (0)
+
/*
* Validate a cached route based on a supplied cookie. If there is an
* out-of-date cache, simply free it. Update the generation number
@@ -424,10 +432,7 @@ struct rt_addrinfo {
#define RT_VALIDATE(ro, cookiep, fibnum) do { \
rt_gen_t cookie = RT_GEN(fibnum, (ro)->ro_dst.sa_family); \
if (*(cookiep) != cookie) { \
- if ((ro)->ro_rt != NULL) { \
- RTFREE((ro)->ro_rt); \
- (ro)->ro_rt = NULL; \
- } \
+ RO_INVALIDATE_CACHE(ro); \
*(cookiep) = cookie; \
} \
} while (0)
diff --git a/freebsd/sys/net/rtsock.c b/freebsd/sys/net/rtsock.c
index fe608d70..851c30c9 100644
--- a/freebsd/sys/net/rtsock.c
+++ b/freebsd/sys/net/rtsock.c
@@ -114,6 +114,12 @@ struct ifa_msghdrl32 {
int32_t ifam_metric;
struct if_data ifam_data;
};
+
+#define SA_SIZE32(sa) \
+ ( (((struct sockaddr *)(sa))->sa_len == 0) ? \
+ sizeof(int) : \
+ 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(int) - 1) ) )
+
#endif /* COMPAT_FREEBSD32 */
MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
@@ -1128,6 +1134,9 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
struct sockaddr_storage ss;
struct sockaddr_in6 *sin6;
#endif
+#ifdef COMPAT_FREEBSD32
+ bool compat32 = false;
+#endif
switch (type) {
@@ -1135,9 +1144,10 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
case RTM_NEWADDR:
if (w != NULL && w->w_op == NET_RT_IFLISTL) {
#ifdef COMPAT_FREEBSD32
- if (w->w_req->flags & SCTL_MASK32)
+ if (w->w_req->flags & SCTL_MASK32) {
len = sizeof(struct ifa_msghdrl32);
- else
+ compat32 = true;
+ } else
#endif
len = sizeof(struct ifa_msghdrl);
} else
@@ -1151,6 +1161,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
len = sizeof(struct if_msghdrl32);
else
len = sizeof(struct if_msghdr32);
+ compat32 = true;
break;
}
#endif
@@ -1181,7 +1192,12 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
if ((sa = rtinfo->rti_info[i]) == NULL)
continue;
rtinfo->rti_addrs |= (1 << i);
- dlen = SA_SIZE(sa);
+#ifdef COMPAT_FREEBSD32
+ if (compat32)
+ dlen = SA_SIZE32(sa);
+ else
+#endif
+ dlen = SA_SIZE(sa);
if (cp != NULL && buflen >= dlen) {
#ifdef INET6
if (V_deembed_scopeid && sa->sa_family == AF_INET6) {
diff --git a/freebsd/sys/net/sff8472.h b/freebsd/sys/net/sff8472.h
index e67aa7f6..d38fcfc0 100644
--- a/freebsd/sys/net/sff8472.h
+++ b/freebsd/sys/net/sff8472.h
@@ -379,7 +379,7 @@ enum {
/*
* Table 3.2 Identifier values.
- * Identifier constants has taken from SFF-8024 rev 2.9 table 4.1
+ * Identifier constants has taken from SFF-8024 rev 4.2 table 4.1
* (as referenced by table 3.2 footer)
* */
enum {
@@ -400,13 +400,15 @@ enum {
SFF_8024_ID_CXP = 0xE, /* CXP */
SFF_8024_ID_HD4X = 0xF, /* Shielded Mini Multilane HD 4X */
SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */
- SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 */
+ SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 or later */
SFF_8024_ID_CXP2 = 0x12, /* CXP2 (aka CXP28) */
SFF_8024_ID_CDFP = 0x13, /* CDFP (Style 1/Style 2) */
SFF_8024_ID_SMM4 = 0x14, /* Shielded Mini Multilate HD 4X Fanout */
SFF_8024_ID_SMM8 = 0x15, /* Shielded Mini Multilate HD 8X Fanout */
SFF_8024_ID_CDFP3 = 0x16, /* CDFP (Style3) */
- SFF_8024_ID_LAST = SFF_8024_ID_CDFP3
+ SFF_8024_ID_MICROQSFP = 0x17, /* microQSFP */
+ SFF_8024_ID_QSFP_DD = 0x18, /* QSFP-DD 8X Pluggable Transceiver */
+ SFF_8024_ID_LAST = SFF_8024_ID_QSFP_DD
};
static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
@@ -431,7 +433,9 @@ static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
"CDFP",
"SMM4",
"SMM8",
- "CDFP3"};
+ "CDFP3",
+ "microQSFP",
+ "QSFP-DD"};
/* Keep compatibility with old definitions */
#define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN