From c1a46f8da14c482d23526df1dd585fe64746b3cb Mon Sep 17 00:00:00 2001 From: akoshibe Date: Sun, 9 Sep 2018 14:21:32 +0000 Subject: [PATCH] Make switchd(8) ignore PACKET_INs generated from looped traffic. Currently, it responds to these messages with an invalid PACKET_OUT onto OFP*_PORT_ANY, resulting in the switch responding with an error, causing switchd to disconnect the switch. OK phessler@ claudio@ --- usr.sbin/switchd/ofp10.c | 5 +++-- usr.sbin/switchd/ofp13.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/switchd/ofp10.c b/usr.sbin/switchd/ofp10.c index 22649448f00..14a14267c48 100644 --- a/usr.sbin/switchd/ofp10.c +++ b/usr.sbin/switchd/ofp10.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofp10.c,v 1.19 2016/12/02 14:39:46 rzalamena Exp $ */ +/* $OpenBSD: ofp10.c,v 1.20 2018/09/09 14:21:32 akoshibe Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter @@ -393,7 +393,8 @@ ofp10_packet_in(struct switchd *sc, struct switch_connection *con, * silently drop looping packet * (don't use OFP10_PORT_INPUT here) */ - dstport = OFP10_PORT_ANY; + ret = 0; + goto done; } else { addflow = 1; } diff --git a/usr.sbin/switchd/ofp13.c b/usr.sbin/switchd/ofp13.c index 9d49e4e886e..0c40a7dbb83 100644 --- a/usr.sbin/switchd/ofp13.c +++ b/usr.sbin/switchd/ofp13.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofp13.c,v 1.43 2017/01/17 09:21:50 rzalamena Exp $ */ +/* $OpenBSD: ofp13.c,v 1.44 2018/09/09 14:21:32 akoshibe Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter @@ -1082,7 +1082,8 @@ ofp13_packet_in(struct switchd *sc, struct switch_connection *con, * silently drop looping packet * (don't use OFP_PORT_INPUT here) */ - dstport = OFP_PORT_ANY; + ret = 0; + goto done; } else { addflow = 1; } -- 2.20.1