On Wed, Nov 07, 2018 at 10:52:59AM +0100, Klemens Nanni wrote:
> On Tue, Nov 06, 2018 at 11:01:37PM -0800, Ayaka Koshibe wrote:
> > Currently, switchd(8) defaults to listening on port 6633, which was
> > the defacto port value used by OpenFlow. A decent chunk of OpenFlow
> > controllers have switched over to the IANA standardized OpenFlow port,
> > 6653. While testing the change, I noticed that switchd(8) will listen on
> > random ports if one isn't specified in switchd.conf(5), e.g:
> That seems reasonable.
>
> > listen on 127.0.0.1
> >
> > The following consolidates the #defines for port values, and also sets a
> > default listen port when it isn't specified in switchd.conf(5).
> Diff reads fine but can you please mention the default settings in
> switchd.conf(5) accordingly?
Sure thing, I hope that 'global configurations' is the right section:
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/parse.y,v
retrieving revision 1.12
diff -u -p -u -r1.12 parse.y
--- parse.y 1 Nov 2018 00:18:44 -0000 1.12
+++ parse.y 7 Nov 2018 16:52:24 -0000
@@ -146,6 +146,8 @@ listen : LISTEN ON STRING opttls port {
YYERROR;
}
free($3);
+ ((struct sockaddr_in *)&conf->sc_server.srv_addr)
+ ->sin_port = htons(SWITCHD_CTLR_PORT);
}
;
@@ -627,7 +629,7 @@ parse_config(const char *filename, struc
conf = sc;
- /* Set the default 0.0.0.0 6633/tcp */
+ /* Set the default 0.0.0.0 6653/tcp */
memset(&conf->sc_server.srv_addr, 0, sizeof(conf->sc_server.srv_addr));
sin4 = (struct sockaddr_in *)&conf->sc_server.srv_addr;
sin4->sin_family = AF_INET;
Index: switchd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/switchd.conf.5,v
retrieving revision 1.8
diff -u -p -u -r1.8 switchd.conf.5
--- switchd.conf.5 30 Oct 2018 07:25:57 -0000 1.8
+++ switchd.conf.5 7 Nov 2018 16:52:24 -0000
@@ -81,6 +81,7 @@ OpenFlow switches.
Secure connections can be enabled with the optional
.Ic tls
keyword.
+The default listen port is 6653.
.\".It Ic device on Ar device-name Oo Ic forward to Ar uri Oc
.\"Attach to a
.\".Xr switch 4
Index: types.h
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/types.h,v
retrieving revision 1.10
diff -u -p -u -r1.10 types.h
--- types.h 18 Nov 2016 16:49:35 -0000 1.10
+++ types.h 7 Nov 2018 16:52:24 -0000
@@ -37,8 +37,7 @@
#define SWITCHD_MAX_TAP 256
#define SWITCHD_MAX_SESSIONS 0xffff
-#define SWITCHD_CTLR_PORT 6633 /* Previously used by OpenFlow */
-#define SWITCHD_CTLR_IANA_PORT 6653 /* Assigned by IANA for OpenFlow */
+#define SWITCHD_CTLR_PORT 6653 /* Assigned by IANA for OpenFlow */
#define SWITCHD_CACHE_MAX 4096 /* Default MAC address cache limit */
#define SWITCHD_CACHE_TIMEOUT 240 /* t/o in seconds for learned MACs */