summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/switchd/ofp10.c36
-rw-r--r--usr.sbin/switchd/ofp_common.c36
-rw-r--r--usr.sbin/switchd/switchd.h8
3 files changed, 40 insertions, 40 deletions
diff --git a/usr.sbin/switchd/ofp10.c b/usr.sbin/switchd/ofp10.c
index 205f7b0a184..5679506f07c 100644
--- a/usr.sbin/switchd/ofp10.c
+++ b/usr.sbin/switchd/ofp10.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp10.c,v 1.12 2016/10/05 15:42:28 reyk Exp $ */
+/* $OpenBSD: ofp10.c,v 1.13 2016/11/11 22:07:40 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -85,40 +85,6 @@ struct ofp_callback ofp10_callbacks[] = {
};
int
-ofp_validate_header(struct switchd *sc,
- struct sockaddr_storage *src, struct sockaddr_storage *dst,
- struct ofp_header *oh, uint8_t version)
-{
- struct constmap *tmap;
-
- /* For debug, don't verify the header if the version is unset */
- if (version != OFP_V_0 &&
- (oh->oh_version != version ||
- oh->oh_type >= OFP_T_TYPE_MAX))
- return (-1);
-
- switch (version) {
- case OFP_V_1_0:
- case OFP_V_1_1:
- tmap = ofp10_t_map;
- break;
- case OFP_V_1_3:
- default:
- tmap = ofp_t_map;
- break;
- }
-
- log_debug("%s > %s: version %s type %s length %u xid %u",
- print_host(src, NULL, 0),
- print_host(dst, NULL, 0),
- print_map(oh->oh_version, ofp_v_map),
- print_map(oh->oh_type, tmap),
- ntohs(oh->oh_length), ntohl(oh->oh_xid));
-
- return (0);
-}
-
-int
ofp10_validate(struct switchd *sc,
struct sockaddr_storage *src, struct sockaddr_storage *dst,
struct ofp_header *oh, struct ibuf *ibuf)
diff --git a/usr.sbin/switchd/ofp_common.c b/usr.sbin/switchd/ofp_common.c
index fee9da2c82b..d3f882442ef 100644
--- a/usr.sbin/switchd/ofp_common.c
+++ b/usr.sbin/switchd/ofp_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp_common.c,v 1.2 2016/11/04 22:27:08 reyk Exp $ */
+/* $OpenBSD: ofp_common.c,v 1.3 2016/11/11 22:07:40 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -44,6 +44,40 @@
#include "ofp_map.h"
int
+ofp_validate_header(struct switchd *sc,
+ struct sockaddr_storage *src, struct sockaddr_storage *dst,
+ struct ofp_header *oh, uint8_t version)
+{
+ struct constmap *tmap;
+
+ /* For debug, don't verify the header if the version is unset */
+ if (version != OFP_V_0 &&
+ (oh->oh_version != version ||
+ oh->oh_type >= OFP_T_TYPE_MAX))
+ return (-1);
+
+ switch (version) {
+ case OFP_V_1_0:
+ case OFP_V_1_1:
+ tmap = ofp10_t_map;
+ break;
+ case OFP_V_1_3:
+ default:
+ tmap = ofp_t_map;
+ break;
+ }
+
+ log_debug("%s > %s: version %s type %s length %u xid %u",
+ print_host(src, NULL, 0),
+ print_host(dst, NULL, 0),
+ print_map(oh->oh_version, ofp_v_map),
+ print_map(oh->oh_type, tmap),
+ ntohs(oh->oh_length), ntohl(oh->oh_xid));
+
+ return (0);
+}
+
+int
ofp_output(struct switch_connection *con, struct ofp_header *oh,
struct ibuf *obuf)
{
diff --git a/usr.sbin/switchd/switchd.h b/usr.sbin/switchd/switchd.h
index b74cc3c5253..610ef0222eb 100644
--- a/usr.sbin/switchd/switchd.h
+++ b/usr.sbin/switchd/switchd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchd.h,v 1.18 2016/11/11 16:59:33 reyk Exp $ */
+/* $OpenBSD: switchd.h,v 1.19 2016/11/11 22:07:40 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -224,9 +224,6 @@ void ofp(struct privsep *, struct privsep_proc *);
void ofp_close(struct switch_connection *);
int ofp_open(struct privsep *, struct switch_connection *);
void ofp_accept(int, short, void *);
-int ofp_validate_header(struct switchd *,
- struct sockaddr_storage *, struct sockaddr_storage *,
- struct ofp_header *, uint8_t);
int ofp_input(struct switch_connection *, struct ibuf *);
/* ofp10.c */
@@ -255,6 +252,9 @@ int ofp13_featuresrequest(struct switchd *,
struct switch_connection *);
/* ofp_common.c */
+int ofp_validate_header(struct switchd *,
+ struct sockaddr_storage *, struct sockaddr_storage *,
+ struct ofp_header *, uint8_t);
int ofp_output(struct switch_connection *, struct ofp_header *,
struct ibuf *);
int ofp_multipart_add(struct switch_connection *, uint32_t,