From 14b22228d7b79b497eefa8002af73ed478a31c0a Mon Sep 17 00:00:00 2001 From: akoshibe Date: Thu, 8 Nov 2018 17:12:12 +0000 Subject: 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. switchd(8) also randomizes its listen ports when one is not specified in switchd.conf(5).conf. Consolidate the #defines for port values, and set a default listen port. OK phessler@ claudio@, kn@ with separate switchd.conf(5) update --- usr.sbin/switchd/parse.y | 6 ++++-- usr.sbin/switchd/types.h | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'usr.sbin/switchd') diff --git a/usr.sbin/switchd/parse.y b/usr.sbin/switchd/parse.y index 81350328438..6da5e5ea0ee 100644 --- a/usr.sbin/switchd/parse.y +++ b/usr.sbin/switchd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.12 2018/11/01 00:18:44 sashan Exp $ */ +/* $OpenBSD: parse.y,v 1.13 2018/11/08 17:12:12 akoshibe Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter @@ -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, struct switchd *sc) 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; diff --git a/usr.sbin/switchd/types.h b/usr.sbin/switchd/types.h index b89bae20712..4976e4cff1e 100644 --- a/usr.sbin/switchd/types.h +++ b/usr.sbin/switchd/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.10 2016/11/18 16:49:35 reyk Exp $ */ +/* $OpenBSD: types.h,v 1.11 2018/11/08 17:12:12 akoshibe Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter @@ -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 */ -- cgit v1.2.3-59-g8ed1b