sync
This commit is contained in:
parent
ae25582c29
commit
3751effe59
23 changed files with 241 additions and 101 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pat_rep.c,v 1.44 2022/01/28 05:15:05 guenther Exp $ */
|
||||
/* $OpenBSD: pat_rep.c,v 1.45 2023/06/26 07:10:17 op Exp $ */
|
||||
/* $NetBSD: pat_rep.c,v 1.4 1995/03/21 09:07:33 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -257,8 +257,8 @@ pat_add(char *str, char *chdirname)
|
|||
|
||||
/*
|
||||
* pat_chk()
|
||||
* complain if any the user supplied pattern did not result in a match to
|
||||
* a selected archive member.
|
||||
* complain if any of the user supplied patterns did not result in
|
||||
* a match to a selected archive member.
|
||||
*/
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: posix_spawn.3,v 1.9 2017/10/17 22:47:58 schwarze Exp $
|
||||
.\" $OpenBSD: posix_spawn.3,v 1.10 2023/06/26 06:58:18 jmc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: October 17 2017 $
|
||||
.Dd $Mdocdate: June 26 2023 $
|
||||
.Dt POSIX_SPAWN 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -122,6 +122,10 @@ with exit status 127.
|
|||
.Sh STANDARDS
|
||||
Both functions conform to
|
||||
.St -p1003.1-2001 .
|
||||
.Pp
|
||||
The handling of NULL
|
||||
.Fa envp
|
||||
is an extension to that standard.
|
||||
.Sh HISTORY
|
||||
These functions were ported from
|
||||
.Fx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: hkdf_evp.c,v 1.19 2022/11/26 16:08:53 tb Exp $ */
|
||||
/* $OpenBSD: hkdf_evp.c,v 1.20 2023/06/26 08:57:17 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@ -129,10 +129,17 @@ pkey_hkdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
|
|||
return 1;
|
||||
|
||||
case EVP_PKEY_CTRL_HKDF_KEY:
|
||||
if (p1 <= 0)
|
||||
if (p1 < 0)
|
||||
return 0;
|
||||
|
||||
freezero(kctx->key, kctx->key_len);
|
||||
kctx->key = NULL;
|
||||
kctx->key_len = 0;
|
||||
|
||||
/* Match OpenSSL's behavior. */
|
||||
if (p1 == 0 || p2 == NULL)
|
||||
return 0;
|
||||
|
||||
if ((kctx->key = malloc(p1)) == NULL)
|
||||
return 0;
|
||||
memcpy(kctx->key, p2, p1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_dwge.c,v 1.15 2023/02/26 13:28:12 kettenis Exp $ */
|
||||
/* $OpenBSD: if_dwge.c,v 1.16 2023/06/25 22:36:09 jmatthew Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
|
||||
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
|
||||
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "kstat.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -54,6 +55,10 @@
|
|||
#include <net/bpf.h>
|
||||
#endif
|
||||
|
||||
#if NKSTAT > 0
|
||||
#include <sys/kstat.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
|
@ -97,8 +102,24 @@
|
|||
#define GMAC_INT_MASK_RIM (1 << 0)
|
||||
#define GMAC_MAC_ADDR0_HI 0x0040
|
||||
#define GMAC_MAC_ADDR0_LO 0x0044
|
||||
#define GMAC_MAC_MMC_CTRL 0x0100
|
||||
#define GMAC_MAC_MMC_CTRL_ROR (1 << 2)
|
||||
#define GMAC_MAC_MMC_CTRL_CR (1 << 0)
|
||||
#define GMAC_MMC_RX_INT_MSK 0x010c
|
||||
#define GMAC_MMC_TX_INT_MSK 0x0110
|
||||
#define GMAC_MMC_TXOCTETCNT_GB 0x0114
|
||||
#define GMAC_MMC_TXFRMCNT_GB 0x0118
|
||||
#define GMAC_MMC_TXUNDFLWERR 0x0148
|
||||
#define GMAC_MMC_TXCARERR 0x0160
|
||||
#define GMAC_MMC_TXOCTETCNT_G 0x0164
|
||||
#define GMAC_MMC_TXFRMCNT_G 0x0168
|
||||
#define GMAC_MMC_RXFRMCNT_GB 0x0180
|
||||
#define GMAC_MMC_RXOCTETCNT_GB 0x0184
|
||||
#define GMAC_MMC_RXOCTETCNT_G 0x0188
|
||||
#define GMAC_MMC_RXMCFRMCNT_G 0x0190
|
||||
#define GMAC_MMC_RXCRCERR 0x0194
|
||||
#define GMAC_MMC_RXLENERR 0x01c8
|
||||
#define GMAC_MMC_RXFIFOOVRFLW 0x01d4
|
||||
#define GMAC_MMC_IPC_INT_MSK 0x0200
|
||||
#define GMAC_BUS_MODE 0x1000
|
||||
#define GMAC_BUS_MODE_8XPBL (1 << 24)
|
||||
|
@ -113,6 +134,7 @@
|
|||
#define GMAC_RX_DESC_LIST_ADDR 0x100c
|
||||
#define GMAC_TX_DESC_LIST_ADDR 0x1010
|
||||
#define GMAC_STATUS 0x1014
|
||||
#define GMAC_STATUS_MMC (1 << 27)
|
||||
#define GMAC_STATUS_RI (1 << 6)
|
||||
#define GMAC_STATUS_TU (1 << 2)
|
||||
#define GMAC_STATUS_TI (1 << 0)
|
||||
|
@ -277,6 +299,11 @@ struct dwge_softc {
|
|||
uint32_t sc_clk_sel_125;
|
||||
uint32_t sc_clk_sel_25;
|
||||
uint32_t sc_clk_sel_2_5;
|
||||
|
||||
#if NKSTAT > 0
|
||||
struct mutex sc_kstat_mtx;
|
||||
struct kstat *sc_kstat;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
|
||||
|
@ -334,6 +361,11 @@ void dwge_dmamem_free(struct dwge_softc *, struct dwge_dmamem *);
|
|||
struct mbuf *dwge_alloc_mbuf(struct dwge_softc *, bus_dmamap_t);
|
||||
void dwge_fill_rx_ring(struct dwge_softc *);
|
||||
|
||||
#if NKSTAT > 0
|
||||
int dwge_kstat_read(struct kstat *);
|
||||
void dwge_kstat_attach(struct dwge_softc *);
|
||||
#endif
|
||||
|
||||
int
|
||||
dwge_match(struct device *parent, void *cfdata, void *aux)
|
||||
{
|
||||
|
@ -555,13 +587,14 @@ dwge_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp);
|
||||
#if NKSTAT > 0
|
||||
dwge_kstat_attach(sc);
|
||||
#endif
|
||||
|
||||
/* Disable interrupts. */
|
||||
dwge_write(sc, GMAC_INT_ENA, 0);
|
||||
dwge_write(sc, GMAC_INT_MASK,
|
||||
GMAC_INT_MASK_LPIIM | GMAC_INT_MASK_PIM | GMAC_INT_MASK_RIM);
|
||||
dwge_write(sc, GMAC_MMC_RX_INT_MSK, 0xffffffff);
|
||||
dwge_write(sc, GMAC_MMC_TX_INT_MSK, 0xffffffff);
|
||||
dwge_write(sc, GMAC_MMC_IPC_INT_MSK, 0xffffffff);
|
||||
|
||||
sc->sc_ih = fdt_intr_establish(faa->fa_node, IPL_NET | IPL_MPSAFE,
|
||||
|
@ -921,6 +954,14 @@ dwge_intr(void *arg)
|
|||
reg & GMAC_STATUS_TU)
|
||||
dwge_tx_proc(sc);
|
||||
|
||||
#if NKSTAT > 0
|
||||
if (reg & GMAC_STATUS_MMC) {
|
||||
mtx_enter(&sc->sc_kstat_mtx);
|
||||
dwge_kstat_read(sc->sc_kstat);
|
||||
mtx_leave(&sc->sc_kstat_mtx);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -1660,3 +1701,77 @@ dwge_mii_statchg_rockchip(struct device *self)
|
|||
|
||||
regmap_write_4(rm, sc->sc_clk_sel, gmac_clk_sel);
|
||||
}
|
||||
|
||||
#if NKSTAT > 0
|
||||
|
||||
struct dwge_counter {
|
||||
const char *c_name;
|
||||
enum kstat_kv_unit c_unit;
|
||||
uint32_t c_reg;
|
||||
};
|
||||
|
||||
const struct dwge_counter dwge_counters[] = {
|
||||
{ "tx octets total", KSTAT_KV_U_BYTES, GMAC_MMC_TXOCTETCNT_GB },
|
||||
{ "tx frames total", KSTAT_KV_U_PACKETS, GMAC_MMC_TXFRMCNT_GB },
|
||||
{ "tx underflow", KSTAT_KV_U_PACKETS, GMAC_MMC_TXUNDFLWERR },
|
||||
{ "tx carrier err", KSTAT_KV_U_PACKETS, GMAC_MMC_TXCARERR },
|
||||
{ "tx good octets", KSTAT_KV_U_BYTES, GMAC_MMC_TXOCTETCNT_G },
|
||||
{ "tx good frames", KSTAT_KV_U_PACKETS, GMAC_MMC_TXFRMCNT_G },
|
||||
{ "rx frames total", KSTAT_KV_U_PACKETS, GMAC_MMC_RXFRMCNT_GB },
|
||||
{ "rx octets total", KSTAT_KV_U_BYTES, GMAC_MMC_RXOCTETCNT_GB },
|
||||
{ "rx good octets", KSTAT_KV_U_BYTES, GMAC_MMC_RXOCTETCNT_G },
|
||||
{ "rx good mcast", KSTAT_KV_U_PACKETS, GMAC_MMC_RXMCFRMCNT_G },
|
||||
{ "rx crc errors", KSTAT_KV_U_PACKETS, GMAC_MMC_RXCRCERR },
|
||||
{ "rx len errors", KSTAT_KV_U_PACKETS, GMAC_MMC_RXLENERR },
|
||||
{ "rx fifo err", KSTAT_KV_U_PACKETS, GMAC_MMC_RXFIFOOVRFLW },
|
||||
};
|
||||
|
||||
void
|
||||
dwge_kstat_attach(struct dwge_softc *sc)
|
||||
{
|
||||
struct kstat *ks;
|
||||
struct kstat_kv *kvs;
|
||||
int i;
|
||||
|
||||
mtx_init(&sc->sc_kstat_mtx, IPL_NET);
|
||||
|
||||
/* clear counters, enable reset-on-read */
|
||||
dwge_write(sc, GMAC_MAC_MMC_CTRL, GMAC_MAC_MMC_CTRL_ROR |
|
||||
GMAC_MAC_MMC_CTRL_CR);
|
||||
|
||||
ks = kstat_create(DEVNAME(sc), 0, "dwge-stats", 0,
|
||||
KSTAT_T_KV, 0);
|
||||
if (ks == NULL)
|
||||
return;
|
||||
|
||||
kvs = mallocarray(nitems(dwge_counters), sizeof(*kvs), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
for (i = 0; i < nitems(dwge_counters); i++) {
|
||||
kstat_kv_unit_init(&kvs[i], dwge_counters[i].c_name,
|
||||
KSTAT_KV_T_COUNTER64, dwge_counters[i].c_unit);
|
||||
}
|
||||
|
||||
kstat_set_mutex(ks, &sc->sc_kstat_mtx);
|
||||
ks->ks_softc = sc;
|
||||
ks->ks_data = kvs;
|
||||
ks->ks_datalen = nitems(dwge_counters) * sizeof(*kvs);
|
||||
ks->ks_read = dwge_kstat_read;
|
||||
sc->sc_kstat = ks;
|
||||
kstat_install(ks);
|
||||
}
|
||||
|
||||
int
|
||||
dwge_kstat_read(struct kstat *ks)
|
||||
{
|
||||
struct kstat_kv *kvs = ks->ks_data;
|
||||
struct dwge_softc *sc = ks->ks_softc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nitems(dwge_counters); i++)
|
||||
kstat_kv_u64(&kvs[i]) += dwge_read(sc, dwge_counters[i].c_reg);
|
||||
|
||||
getnanouptime(&ks->ks_updated);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pf_ioctl.c,v 1.405 2023/05/26 12:13:26 kn Exp $ */
|
||||
/* $OpenBSD: pf_ioctl.c,v 1.406 2023/06/26 07:49:48 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
|
@ -118,6 +118,7 @@ int pf_states_clr(struct pfioc_state_kill *);
|
|||
int pf_states_get(struct pfioc_states *);
|
||||
|
||||
struct pf_trans *pf_open_trans(uint32_t);
|
||||
void pf_close_all_trans(uint32_t);
|
||||
struct pf_trans *pf_find_trans(uint32_t, uint64_t);
|
||||
void pf_free_trans(struct pf_trans *);
|
||||
void pf_rollback_trans(struct pf_trans *);
|
||||
|
@ -1491,6 +1492,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|||
PF_UNLOCK();
|
||||
NET_UNLOCK();
|
||||
|
||||
pf_close_all_trans(minor(dev));
|
||||
t = pf_open_trans(minor(dev));
|
||||
pf_init_tgetrule(t, ruleset->anchor, ruleset_version, rule);
|
||||
pr->ticket = t->pft_ticket;
|
||||
|
@ -3273,6 +3275,19 @@ pf_open_trans(uint32_t unit)
|
|||
return (t);
|
||||
}
|
||||
|
||||
void
|
||||
pf_close_all_trans(uint32_t unit)
|
||||
{
|
||||
struct pf_trans *t, *nt;
|
||||
|
||||
rw_assert_wrlock(&pfioctl_rw);
|
||||
|
||||
LIST_FOREACH_SAFE(t, &pf_ioctl_trans, pft_entry, nt) {
|
||||
if (t->pft_unit == unit)
|
||||
pf_rollback_trans(t);
|
||||
}
|
||||
}
|
||||
|
||||
struct pf_trans *
|
||||
pf_find_trans(uint32_t unit, uint64_t ticket)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rtsock.c,v 1.365 2023/04/20 21:43:17 mvs Exp $ */
|
||||
/* $OpenBSD: rtsock.c,v 1.367 2023/06/26 07:52:18 claudio Exp $ */
|
||||
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: screen.c,v 1.81 2022/06/30 09:55:53 nicm Exp $ */
|
||||
/* $OpenBSD: screen.c,v 1.82 2023/06/26 08:14:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -626,7 +626,7 @@ screen_alternate_off(struct screen *s, struct grid_cell *gc, int cursor)
|
|||
* before copying back.
|
||||
*/
|
||||
if (s->saved_grid != NULL)
|
||||
screen_resize(s, s->saved_grid->sx, s->saved_grid->sy, 1);
|
||||
screen_resize(s, s->saved_grid->sx, s->saved_grid->sy, 0);
|
||||
|
||||
/*
|
||||
* Restore the cursor position and cell. This happens even if not
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: style.c,v 1.31 2022/06/30 09:55:53 nicm Exp $ */
|
||||
/* $OpenBSD: style.c,v 1.32 2023/06/26 07:17:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -77,6 +77,7 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
|
|||
if (strcasecmp(tmp, "default") == 0) {
|
||||
sy->gc.fg = base->fg;
|
||||
sy->gc.bg = base->bg;
|
||||
sy->gc.us = base->us;
|
||||
sy->gc.attr = base->attr;
|
||||
sy->gc.flags = base->flags;
|
||||
} else if (strcasecmp(tmp, "ignore") == 0)
|
||||
|
@ -162,6 +163,13 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
|
|||
sy->gc.bg = base->bg;
|
||||
} else
|
||||
goto error;
|
||||
} else if (end > 3 && strncasecmp(tmp, "us=", 3) == 0) {
|
||||
if ((value = colour_fromstring(tmp + 3)) == -1)
|
||||
goto error;
|
||||
if (value != 8)
|
||||
sy->gc.us = value;
|
||||
else
|
||||
sy->gc.us = base->us;
|
||||
} else if (strcasecmp(tmp, "none") == 0)
|
||||
sy->gc.attr = 0;
|
||||
else if (end > 2 && strncasecmp(tmp, "no", 2) == 0) {
|
||||
|
@ -258,6 +266,11 @@ style_tostring(struct style *sy)
|
|||
colour_tostring(gc->bg));
|
||||
comma = ",";
|
||||
}
|
||||
if (gc->us != 8) {
|
||||
off += xsnprintf(s + off, sizeof s - off, "%sus=%s", comma,
|
||||
colour_tostring(gc->us));
|
||||
comma = ",";
|
||||
}
|
||||
if (gc->attr != 0) {
|
||||
xsnprintf(s + off, sizeof s - off, "%s%s", comma,
|
||||
attributes_tostring(gc->attr));
|
||||
|
@ -287,6 +300,8 @@ style_add(struct grid_cell *gc, struct options *oo, const char *name,
|
|||
gc->fg = sy->gc.fg;
|
||||
if (sy->gc.bg != 8)
|
||||
gc->bg = sy->gc.bg;
|
||||
if (sy->gc.us != 8)
|
||||
gc->us = sy->gc.us;
|
||||
gc->attr |= sy->gc.attr;
|
||||
|
||||
if (ft0 != NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: tmux.1,v 1.920 2023/05/19 07:46:34 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.921 2023/06/26 07:17:40 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: May 19 2023 $
|
||||
.Dd $Mdocdate: June 26 2023 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -5384,6 +5384,8 @@ for the terminal default colour; or a hexadecimal RGB string such as
|
|||
.Ql #ffffff .
|
||||
.It Ic bg=colour
|
||||
Set the background colour.
|
||||
.It Ic us=colour
|
||||
Set the underscore colour.
|
||||
.It Ic none
|
||||
Set no attributes (turn off any active attributes).
|
||||
.It Xo Ic acs ,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty.c,v 1.430 2023/04/25 09:31:50 nicm Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.431 2023/06/26 07:17:40 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -483,6 +483,12 @@ tty_update_features(struct tty *tty)
|
|||
if (tty->term->flags & TERM_VT100LIKE)
|
||||
tty_puts(tty, "\033[?7727h");
|
||||
|
||||
/*
|
||||
* Features might have changed since the first draw during attach. For
|
||||
* example, this happens when DA responses are received.
|
||||
*/
|
||||
server_redraw_client(c);
|
||||
|
||||
tty_invalidate(tty);
|
||||
}
|
||||
|
||||
|
@ -2808,9 +2814,10 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
|
|||
gc->us = c;
|
||||
}
|
||||
|
||||
/* Underscore colour is set as RGB so convert a 256 colour to RGB. */
|
||||
if (gc->us & COLOUR_FLAG_256)
|
||||
gc->us = colour_256toRGB (gc->us);
|
||||
/* Underscore colour is set as RGB so convert. */
|
||||
gc->us = colour_force_rgb (gc->us);
|
||||
if (gc->us == -1)
|
||||
gc->us = 8;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ask_nbrs2.c,v 1.5 2015/12/07 19:17:18 mmcc Exp $ */
|
||||
/* $OpenBSD: ask_nbrs2.c,v 1.6 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -36,7 +36,6 @@ send_ask_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
int ret = 0;
|
||||
|
||||
log_debug("send_ask_nbrs2: interface %s addr %s",
|
||||
|
@ -56,11 +55,7 @@ send_ask_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
dst.sin_addr.s_addr = addr.s_addr;
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dvmrpe.h,v 1.7 2021/01/19 12:23:30 claudio Exp $ */
|
||||
/* $OpenBSD: dvmrpe.h,v 1.8 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -183,7 +183,8 @@ struct ctl_nbr *nbr_to_ctl(struct nbr *);
|
|||
|
||||
/* packet.c */
|
||||
int gen_dvmrp_hdr(struct ibuf *, struct iface *, u_int8_t);
|
||||
int send_packet(struct iface *, void *, size_t, struct sockaddr_in *);
|
||||
int send_packet(struct iface *, struct ibuf *,
|
||||
struct sockaddr_in *);
|
||||
void recv_packet(int, short, void *);
|
||||
|
||||
/* probe.c */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: graft.c,v 1.5 2015/12/07 19:17:18 mmcc Exp $ */
|
||||
/* $OpenBSD: graft.c,v 1.6 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -36,7 +36,6 @@ send_graft(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
int ret = 0;
|
||||
|
||||
log_debug("send_graft: interface %s addr %s",
|
||||
|
@ -56,11 +55,7 @@ send_graft(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
dst.sin_addr.s_addr = addr.s_addr;
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: graft_ack.c,v 1.5 2015/12/07 19:17:18 mmcc Exp $ */
|
||||
/* $OpenBSD: graft_ack.c,v 1.6 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -36,7 +36,6 @@ send_graft_ack(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
int ret = 0;
|
||||
|
||||
log_debug("send_graft_ack: interface %s addr %s",
|
||||
|
@ -56,11 +55,7 @@ send_graft_ack(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
dst.sin_addr.s_addr = addr.s_addr;
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: igmp.c,v 1.4 2015/12/07 19:14:49 mmcc Exp $ */
|
||||
/* $OpenBSD: igmp.c,v 1.5 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -73,9 +73,6 @@ send_igmp_query(struct iface *iface, struct group *group)
|
|||
igmp_hdr.max_resp_time = iface->last_member_query_interval;
|
||||
}
|
||||
|
||||
/* update chksum */
|
||||
igmp_hdr.chksum = in_cksum(&igmp_hdr, sizeof(igmp_hdr));
|
||||
|
||||
ibuf_add(buf, &igmp_hdr, sizeof(igmp_hdr));
|
||||
|
||||
/* set destination address */
|
||||
|
@ -83,7 +80,7 @@ send_igmp_query(struct iface *iface, struct group *group)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
inet_aton(AllSystems, &dst.sin_addr);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: nbrs2.c,v 1.4 2015/05/05 01:26:37 jsg Exp $ */
|
||||
/* $OpenBSD: nbrs2.c,v 1.5 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -37,7 +37,6 @@ send_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
int ret = 0;
|
||||
|
||||
log_debug("send_nbrs2: interface %s addr %s",
|
||||
|
@ -57,11 +56,7 @@ send_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
dst.sin_addr.s_addr = addr.s_addr;
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: packet.c,v 1.7 2021/01/19 16:02:56 claudio Exp $ */
|
||||
/* $OpenBSD: packet.c,v 1.8 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <event.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -61,8 +62,10 @@ gen_dvmrp_hdr(struct ibuf *buf, struct iface *iface, u_int8_t code)
|
|||
|
||||
/* send and receive packets */
|
||||
int
|
||||
send_packet(struct iface *iface, void *pkt, size_t len, struct sockaddr_in *dst)
|
||||
send_packet(struct iface *iface, struct ibuf *pkt, struct sockaddr_in *dst)
|
||||
{
|
||||
u_int16_t chksum;
|
||||
|
||||
if (iface->passive) {
|
||||
log_warnx("send_packet: cannot send packet on passive "
|
||||
"interface %s", iface->name);
|
||||
|
@ -77,7 +80,15 @@ send_packet(struct iface *iface, void *pkt, size_t len, struct sockaddr_in *dst)
|
|||
return (-1);
|
||||
}
|
||||
|
||||
if (sendto(iface->fd, pkt, len, 0,
|
||||
/* update chksum */
|
||||
chksum = in_cksum(ibuf_data(pkt), ibuf_size(pkt));
|
||||
if (ibuf_set(pkt, offsetof(struct dvmrp_hdr, chksum),
|
||||
&chksum, sizeof(chksum)) == -1) {
|
||||
log_warn("send_packet: failed to update checksum");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (sendto(iface->fd, ibuf_data(pkt), ibuf_size(pkt), 0,
|
||||
(struct sockaddr *)dst, sizeof(*dst)) == -1 ) {
|
||||
log_warn("send_packet: error sending packet on interface %s",
|
||||
iface->name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: probe.c,v 1.4 2015/05/05 01:26:37 jsg Exp $ */
|
||||
/* $OpenBSD: probe.c,v 1.5 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -39,7 +39,6 @@ send_probe(struct iface *iface)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
struct nbr *nbr;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -67,11 +66,7 @@ send_probe(struct iface *iface)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
inet_aton(AllDVMRPRouters, &dst.sin_addr);
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: prune.c,v 1.6 2015/12/07 19:14:49 mmcc Exp $ */
|
||||
/* $OpenBSD: prune.c,v 1.7 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -37,7 +37,6 @@ send_prune(struct nbr *nbr, struct prune *p)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
struct prune_hdr prune;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -69,11 +68,7 @@ send_prune(struct nbr *nbr, struct prune *p)
|
|||
|
||||
ibuf_add(buf, &prune, sizeof(prune));
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(nbr->iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(nbr->iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
|
||||
return (ret);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: report.c,v 1.11 2015/12/07 18:59:31 mmcc Exp $ */
|
||||
/* $OpenBSD: report.c,v 1.12 2023/06/26 10:08:56 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
|
||||
|
@ -41,7 +41,6 @@ send_report(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
{
|
||||
struct sockaddr_in dst;
|
||||
struct ibuf *buf;
|
||||
struct dvmrp_hdr *dvmrp_hdr;
|
||||
int ret = 0;
|
||||
|
||||
log_debug("send_report: interface %s addr %s",
|
||||
|
@ -63,11 +62,7 @@ send_report(struct iface *iface, struct in_addr addr, void *data, int len)
|
|||
dst.sin_len = sizeof(struct sockaddr_in);
|
||||
dst.sin_addr.s_addr = addr.s_addr;
|
||||
|
||||
/* update chksum */
|
||||
dvmrp_hdr = ibuf_seek(buf, 0, sizeof(*dvmrp_hdr));
|
||||
dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos);
|
||||
|
||||
ret = send_packet(iface, buf->buf, buf->wpos, &dst);
|
||||
ret = send_packet(iface, buf, &dst);
|
||||
ibuf_free(buf);
|
||||
return (ret);
|
||||
fail:
|
||||
|
@ -247,7 +242,7 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr)
|
|||
|
||||
prefixlen = 0;
|
||||
while (((le = TAILQ_FIRST(rr_list)) != NULL) &&
|
||||
(buf->wpos < 1000)) {
|
||||
(ibuf_size(buf) < 1000)) {
|
||||
/* netmask */
|
||||
netmask = le->re->mask.s_addr;
|
||||
if (prefixlen != mask2prefixlen(netmask)) {
|
||||
|
@ -288,7 +283,7 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr)
|
|||
rr_list_remove(le->re);
|
||||
free(le);
|
||||
}
|
||||
send_report(iface, addr, buf->buf, buf->wpos);
|
||||
send_report(iface, addr, ibuf_data(buf), ibuf_size(buf));
|
||||
ibuf_free(buf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: packet.c,v 1.20 2021/01/19 11:49:26 claudio Exp $ */
|
||||
/* $OpenBSD: packet.c,v 1.21 2023/06/26 14:07:19 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
|
||||
|
@ -172,12 +172,11 @@ send_packet(struct eigrp_iface *ei, struct nbr *nbr, uint32_t flags,
|
|||
eigrp_hdr->ack_num = htonl(nbr->recv_seq);
|
||||
rtp_ack_stop_timer(nbr);
|
||||
}
|
||||
if (flags) {
|
||||
eigrp_hdr->flags = ntohl(eigrp_hdr->flags) | flags;
|
||||
eigrp_hdr->flags = htonl(eigrp_hdr->flags);
|
||||
}
|
||||
if (flags)
|
||||
eigrp_hdr->flags |= htonl(flags);
|
||||
|
||||
eigrp_hdr->chksum = 0;
|
||||
eigrp_hdr->chksum = in_cksum(buf->buf, ibuf_size(buf));
|
||||
eigrp_hdr->chksum = in_cksum(ibuf_data(buf), ibuf_size(buf));
|
||||
|
||||
/* log packet being sent */
|
||||
if (eigrp_hdr->opcode != EIGRP_OPC_HELLO) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tlv.c,v 1.16 2021/11/03 13:48:46 deraadt Exp $ */
|
||||
/* $OpenBSD: tlv.c,v 1.17 2023/06/26 14:07:19 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -51,13 +52,14 @@ gen_parameter_tlv(struct ibuf *buf, struct eigrp_iface *ei, int peerterm)
|
|||
int
|
||||
gen_sequence_tlv(struct ibuf *buf, struct seq_addr_head *seq_addr_list)
|
||||
{
|
||||
struct tlv tlv, *tlvp;
|
||||
struct tlv tlv;
|
||||
struct seq_addr_entry *sa;
|
||||
uint8_t alen;
|
||||
uint16_t len = TLV_HDR_LEN;
|
||||
size_t original_size = ibuf_size(buf);
|
||||
size_t off;
|
||||
|
||||
tlv.type = htons(TLV_TYPE_SEQ);
|
||||
off = ibuf_size(buf) + offsetof(struct tlv, length);
|
||||
if (ibuf_add(buf, &tlv, sizeof(tlv))) {
|
||||
log_warn("%s: ibuf_add failed", __func__);
|
||||
return (-1);
|
||||
|
@ -85,9 +87,8 @@ gen_sequence_tlv(struct ibuf *buf, struct seq_addr_head *seq_addr_list)
|
|||
}
|
||||
|
||||
/* adjust tlv length */
|
||||
if ((tlvp = ibuf_seek(buf, original_size, sizeof(*tlvp))) == NULL)
|
||||
fatalx("gen_sequence_tlv: buf_seek failed");
|
||||
tlvp->length = htons(len);
|
||||
if (ibuf_set_n16(buf, off, len) == -1)
|
||||
fatalx("gen_sequence_tlv: buf_set_n16 failed");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -158,13 +159,13 @@ len_route_tlv(struct rinfo *ri)
|
|||
int
|
||||
gen_route_tlv(struct ibuf *buf, struct rinfo *ri)
|
||||
{
|
||||
struct tlv tlv, *tlvp;
|
||||
struct tlv tlv;
|
||||
struct in_addr addr;
|
||||
struct classic_metric metric;
|
||||
struct classic_emetric emetric;
|
||||
uint16_t tlvlen;
|
||||
uint8_t pflen;
|
||||
size_t original_size = ibuf_size(buf);
|
||||
size_t off;
|
||||
|
||||
switch (ri->af) {
|
||||
case AF_INET:
|
||||
|
@ -189,6 +190,7 @@ gen_route_tlv(struct ibuf *buf, struct rinfo *ri)
|
|||
}
|
||||
tlv.type = htons(tlv.type);
|
||||
|
||||
off = ibuf_size(buf) + offsetof(struct tlv, length);
|
||||
if (ibuf_add(buf, &tlv, sizeof(tlv)))
|
||||
return (-1);
|
||||
tlvlen = TLV_HDR_LEN;
|
||||
|
@ -251,9 +253,8 @@ gen_route_tlv(struct ibuf *buf, struct rinfo *ri)
|
|||
tlvlen += sizeof(pflen) + pflen;
|
||||
|
||||
/* adjust tlv length */
|
||||
if ((tlvp = ibuf_seek(buf, original_size, sizeof(*tlvp))) == NULL)
|
||||
fatalx("gen_route_tlv: buf_seek failed");
|
||||
tlvp->length = htons(tlvlen);
|
||||
if (ibuf_set_n16(buf, off, tlvlen) == -1)
|
||||
fatalx("gen_route_tlv: buf_set_n16 failed");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: conn.c,v 1.20 2023/04/30 23:49:14 jsg Exp $ */
|
||||
/* $OpenBSD: conn.c,v 1.21 2023/06/26 10:28:12 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
|
||||
|
@ -242,7 +242,8 @@ conn_err(struct bufferevent *bev, short why, void *data)
|
|||
else if ((why & EVBUFFER_TIMEOUT) == EVBUFFER_TIMEOUT)
|
||||
log_debug("timeout on connection %d", conn->fd);
|
||||
else
|
||||
log_warnx("error 0x%02X on connection %d", why, conn->fd);
|
||||
log_warn("%s error on connection %d",
|
||||
why & EVBUFFER_WRITE ? "write" : "read", conn->fd);
|
||||
|
||||
conn_close(conn);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue