-/* $OpenBSD: brconfig.c,v 1.29 2020/08/08 12:38:21 kn Exp $ */
+/* $OpenBSD: brconfig.c,v 1.30 2021/11/11 09:39:16 claudio Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
void bridge_list(char *);
void bridge_cfg(const char *);
-void switch_cfg(const char *);
void bridge_badrule(int, char **, int);
void bridge_showrule(struct ifbrlreq *);
-int is_switch(void);
int bridge_arprule(struct ifbrlreq *, int *, char ***);
#define IFBAFBITS "\020\1STATIC"
bridge_status(void)
{
struct ifbrparam bp1, bp2;
- int isswitch;
if (is_tpmr()) {
bridge_list("\t");
if (!is_bridge())
return;
- isswitch = is_switch();
- if (isswitch)
- switch_cfg("\t");
- else
- bridge_cfg("\t");
-
+ bridge_cfg("\t");
bridge_list("\t");
if (aflag && !ifaliases)
return;
- if (isswitch)
- return;
-
strlcpy(bp1.ifbrp_name, ifname, sizeof(bp1.ifbrp_name));
if (ioctl(sock, SIOCBRDGGCACHE, (caddr_t)&bp1) == -1)
return;
fprintf(stderr, "\n");
}
-int
-is_switch()
-{
- struct ifbrparam bp;
-
- strlcpy(bp.ifbrp_name, ifname, sizeof(bp.ifbrp_name));
- if (ioctl(sock, SIOCSWGDPID, (caddr_t)&bp) == -1)
- return (0);
-
- return (1);
-}
-
-void
-switch_cfg(const char *delim)
-{
- struct ifbrparam bp;
-
- strlcpy(bp.ifbrp_name, ifname, sizeof(bp.ifbrp_name));
- if (ioctl(sock, SIOCSWGDPID, (caddr_t)&bp) == -1)
- err(1, "%s", ifname);
-
- printf("%sdatapath %#016llx", delim, bp.ifbrp_datapath);
-
- strlcpy(bp.ifbrp_name, ifname, sizeof(bp.ifbrp_name));
- if (ioctl(sock, SIOCSWGMAXFLOW, (caddr_t)&bp) == -1)
- err(1, "%s", ifname);
-
- printf(" maxflow %d", bp.ifbrp_maxflow);
-
- strlcpy(bp.ifbrp_name, ifname, sizeof(bp.ifbrp_name));
- if (ioctl(sock, SIOCSWGMAXGROUP, (caddr_t)&bp) == -1)
- err(1, "%s", ifname);
-
- printf(" maxgroup %d\n", bp.ifbrp_maxgroup);
-}
-
-void
-switch_datapathid(const char *arg, int d)
-{
- struct ifbrparam bp;
- uint64_t newdpid;
- char *endptr;
-
- errno = 0;
- newdpid = strtoull(arg, &endptr, 0);
- if (arg[0] == '\0' || endptr[0] != '\0' || errno == ERANGE)
- errx(1, "invalid arg for datapath-id: %s", arg);
-
- strlcpy(bp.ifbrp_name, ifname, sizeof(bp.ifbrp_name));
- bp.ifbrp_datapath = newdpid;
- if (ioctl(sock, SIOCSWSDPID, (caddr_t)&bp) == -1)
- err(1, "%s", ifname);
-}
-
-void
-switch_portno(const char *ifsname, const char *val)
-{
- struct ifbreq breq;
- const char *errstr;
-
- breq.ifbr_portno = strtonum(val, 0, UINT32_MAX, &errstr);
- if (errstr)
- errx(1, "portno %s is: %s", val, errstr);
-
- strlcpy(breq.ifbr_name, ifname, sizeof(breq.ifbr_name));
- strlcpy(breq.ifbr_ifsname, ifsname, sizeof(breq.ifbr_ifsname));
- if (ioctl(sock, SIOCSWSPORTNO, (caddr_t)&breq) == -1) {
- if (errno == EEXIST)
- return;
- else
- err(1, "%s", ifname);
- }
-}
-
#endif
-.\" $OpenBSD: ifconfig.8,v 1.378 2021/10/29 16:42:57 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.379 2021/11/11 09:39:16 claudio Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: October 29 2021 $
+.Dd $Mdocdate: November 11 2021 $
.Dt IFCONFIG 8
.Os
.Sh NAME
.Ql none .
In the latter case, authentication will be turned off.
.El
-.Sh SWITCH
-The following options are available for a
-.Xr switch 4
-interface:
-.Bl -tag -width Ds
-.It Cm add Ar interface
-Add
-.Ar interface
-as a member of the switch.
-The interface is put into promiscuous mode so
-that it can receive every packet sent on the
-network.
-An interface can be a member of at most one switch.
-.It Cm addlocal Ar interface
-Add
-.Ar interface
-as a local port of the switch.
-Local port is a special port connected with the local system's network stack.
-Only
-.Xr vether 4
-can be used for the
-.Ar interface .
-Only one interface can be added as a local port.
-.It Cm datapath Ar id
-Configure the datapath ID for the switch.
-The default value is generated randomly.
-.It Cm del Ar interface
-Remove
-.Ar interface
-from the switch.
-Promiscuous mode is turned off for the interface when it is removed
-from the switch.
-.It Cm maxflow Ar number
-Set the maximum number of flows per table.
-The default value is 10000.
-.It Cm maxgroup Ar number
-Set the maximum number of groups.
-The default value is 1000.
-.It Cm portno Ar interface number
-Set the port number for the port named
-.Ar interface .
-The default value is the interface index of the
-.Ar interface .
-.It Cm protected Ar interface ids
-Put
-.Ar interface
-in protected domains.
-.Ar ids
-is a comma delimited list of domain IDs, between 1 and 31, to put the
-interface in.
-Interfaces that are part of a protected domain cannot forward traffic to any
-other interface in that domain.
-Interfaces do not belong to any protected domain by default.
-.It Cm -protected Ar interface
-Remove
-.Ar interface
-from all protected domains.
-.It Cm up
-Start the switch processing packets.
-.El
.Sh TPMR
.nr nS 1
.Bk -words
-/* $OpenBSD: ifconfig.c,v 1.448 2021/11/03 02:02:36 kn Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.449 2021/11/11 09:39:16 claudio Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
{ "-roaming", 0, 0, umb_roaming },
{ "patch", NEXTARG, 0, setpair },
{ "-patch", 1, 0, unsetpair },
- { "datapath", NEXTARG, 0, switch_datapathid },
- { "portno", NEXTARG2, 0, NULL, switch_portno },
{ "addlocal", NEXTARG, 0, addlocal },
{ "transceiver", NEXTARG0, 0, transceiver },
{ "sff", NEXTARG0, 0, transceiver },
-/* $OpenBSD: ifconfig.h,v 1.3 2020/08/05 06:12:43 kn Exp $ */
+/* $OpenBSD: ifconfig.h,v 1.4 2021/11/11 09:39:16 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
int is_bridge(void);
void bridge_status(void);
int bridge_rule(int, char **, int);
-void switch_datapathid(const char *, int);
-void switch_portno(const char *, const char *);
int if_sff_info(int);