From: claudio Date: Thu, 11 Nov 2021 09:39:16 +0000 (+0000) Subject: Remove switch(4) specific bits from ifconfig. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ffcecb3d0c59d3e1ae9121662b543ffaed463d1b;p=openbsd Remove switch(4) specific bits from ifconfig. OK deraadt@ patrick@ --- diff --git a/sbin/ifconfig/brconfig.c b/sbin/ifconfig/brconfig.c index 1fa246b1635..dcd6496af0a 100644 --- a/sbin/ifconfig/brconfig.c +++ b/sbin/ifconfig/brconfig.c @@ -1,4 +1,4 @@ -/* $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) @@ -54,10 +54,8 @@ void bridge_ifclrflag(const char *, u_int32_t); 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" @@ -753,7 +751,6 @@ void bridge_status(void) { struct ifbrparam bp1, bp2; - int isswitch; if (is_tpmr()) { bridge_list("\t"); @@ -763,20 +760,12 @@ bridge_status(void) 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; @@ -1122,78 +1111,4 @@ bridge_badrule(int argc, char *argv[], int ln) 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 diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index c5b5ab37ea2..e424700f336 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -1,4 +1,4 @@ -.\" $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 $ .\" @@ -31,7 +31,7 @@ .\" .\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 .\" -.Dd $Mdocdate: October 29 2021 $ +.Dd $Mdocdate: November 11 2021 $ .Dt IFCONFIG 8 .Os .Sh NAME @@ -1708,66 +1708,6 @@ or .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 diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index f60e2e57733..e02c0550b4f 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -608,8 +608,6 @@ const struct cmd { { "-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 }, diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 17555761d59..806a5e639cb 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -1,4 +1,4 @@ -/* $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 @@ -69,7 +69,5 @@ void bridge_flushrule(const char *, int); 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);