This commit is contained in:
purplerain 2023-06-27 23:12:38 +00:00
parent 29ec20d7b2
commit 777fb69d26
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
16 changed files with 139 additions and 143 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.700 2023/06/12 21:19:54 mvs Exp $ */
/* $OpenBSD: if.c,v 1.701 2023/06/27 21:02:13 mvs Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@ -2784,7 +2784,7 @@ if_creategroup(const char *groupname)
{
struct ifg_group *ifg;
if ((ifg = malloc(sizeof(*ifg), M_TEMP, M_NOWAIT)) == NULL)
if ((ifg = malloc(sizeof(*ifg), M_IFGROUP, M_NOWAIT)) == NULL)
return (NULL);
strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
@ -2819,11 +2819,11 @@ if_addgroup(struct ifnet *ifp, const char *groupname)
if (!strcmp(ifgl->ifgl_group->ifg_group, groupname))
return (EEXIST);
if ((ifgl = malloc(sizeof(*ifgl), M_TEMP, M_NOWAIT)) == NULL)
if ((ifgl = malloc(sizeof(*ifgl), M_IFGROUP, M_NOWAIT)) == NULL)
return (ENOMEM);
if ((ifgm = malloc(sizeof(*ifgm), M_TEMP, M_NOWAIT)) == NULL) {
free(ifgl, M_TEMP, sizeof(*ifgl));
if ((ifgm = malloc(sizeof(*ifgm), M_IFGROUP, M_NOWAIT)) == NULL) {
free(ifgl, M_IFGROUP, sizeof(*ifgl));
return (ENOMEM);
}
@ -2834,8 +2834,8 @@ if_addgroup(struct ifnet *ifp, const char *groupname)
if (ifg == NULL) {
ifg = if_creategroup(groupname);
if (ifg == NULL) {
free(ifgl, M_TEMP, sizeof(*ifgl));
free(ifgm, M_TEMP, sizeof(*ifgm));
free(ifgl, M_IFGROUP, sizeof(*ifgl));
free(ifgm, M_IFGROUP, sizeof(*ifgm));
return (ENOMEM);
}
} else
@ -2878,7 +2878,7 @@ if_delgroup(struct ifnet *ifp, const char *groupname)
if (ifgm != NULL) {
TAILQ_REMOVE(&ifgl->ifgl_group->ifg_members, ifgm, ifgm_next);
free(ifgm, M_TEMP, sizeof(*ifgm));
free(ifgm, M_IFGROUP, sizeof(*ifgm));
}
#if NPF > 0
@ -2891,10 +2891,10 @@ if_delgroup(struct ifnet *ifp, const char *groupname)
#if NPF > 0
pfi_detach_ifgroup(ifgl->ifgl_group);
#endif
free(ifgl->ifgl_group, M_TEMP, sizeof(*ifgl->ifgl_group));
free(ifgl->ifgl_group, M_IFGROUP, sizeof(*ifgl->ifgl_group));
}
free(ifgl, M_TEMP, sizeof(*ifgl));
free(ifgl, M_IFGROUP, sizeof(*ifgl));
return (0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pf_ioctl.c,v 1.406 2023/06/26 07:49:48 claudio Exp $ */
/* $OpenBSD: pf_ioctl.c,v 1.408 2023/06/27 17:36:56 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -2944,11 +2944,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
goto fail;
}
NET_LOCK();
NET_LOCK_SHARED();
PF_LOCK();
pfi_get_ifaces(io->pfiio_name, kif_buf, &io->pfiio_size);
PF_UNLOCK();
NET_UNLOCK();
NET_UNLOCK_SHARED();
if (copyout(kif_buf, io->pfiio_buffer, sizeof(*kif_buf) *
io->pfiio_size))
error = EFAULT;
@ -2964,11 +2964,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
goto fail;
}
NET_LOCK();
PF_LOCK();
error = pfi_set_flags(io->pfiio_name, io->pfiio_flags);
PF_UNLOCK();
NET_UNLOCK();
break;
}
@ -2980,11 +2978,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
goto fail;
}
NET_LOCK();
PF_LOCK();
error = pfi_clear_flags(io->pfiio_name, io->pfiio_flags);
PF_UNLOCK();
NET_UNLOCK();
break;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.h,v 1.122 2022/02/03 17:18:22 guenther Exp $ */
/* $OpenBSD: malloc.h,v 1.123 2023/06/27 21:02:13 mvs Exp $ */
/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
/*
@ -72,7 +72,7 @@
/* 7 - free */
/* 8 - free */
#define M_IFADDR 9 /* interface address */
/* 10 - free */
#define M_IFGROUP 10 /* interface group */
#define M_SYSCTL 11 /* sysctl buffers (persistent storage) */
#define M_COUNTERS 12 /* per CPU counters */
/* 13 - free */
@ -190,7 +190,7 @@
NULL, \
NULL, \
"ifaddr", /* 9 M_IFADDR */ \
NULL, \
"ifgroup", /* 10 M_IFGROUP */ \
"sysctl", /* 11 M_SYSCTL */ \
"counters", /* 12 M_COUNTERS */ \
NULL, \