diff options
| author | 2016-10-28 09:01:49 +0000 | |
|---|---|---|
| committer | 2016-10-28 09:01:49 +0000 | |
| commit | 98c2c8ff25236bc867c901f4681f967f2dc99ecd (patch) | |
| tree | b7efe8f35666c72e62fc33ead67712cb66dbdec0 | |
| parent | Use snmpd_env as the only global variable for env to simplify the daemon (diff) | |
| download | wireguard-openbsd-98c2c8ff25236bc867c901f4681f967f2dc99ecd.tar.xz wireguard-openbsd-98c2c8ff25236bc867c901f4681f967f2dc99ecd.zip | |
When doing pktout we must run the classifier again, because some action(s)
might want to use it. For buffered packets we probably need to save that
somehow else, but we don't support it now.
ok reyk@
| -rw-r--r-- | sys/net/if_switch.c | 5 | ||||
| -rw-r--r-- | sys/net/if_switch.h | 5 | ||||
| -rw-r--r-- | sys/net/switchofp.c | 15 |
3 files changed, 18 insertions, 7 deletions
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c index 15adba98378..9d8562ce6b9 100644 --- a/sys/net/if_switch.c +++ b/sys/net/if_switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.c,v 1.9 2016/10/08 23:36:10 rzalamena Exp $ */ +/* $OpenBSD: if_switch.c,v 1.10 2016/10/28 09:01:49 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -124,9 +124,6 @@ struct mbuf struct mbuf *switch_flow_classifier_tunnel(struct mbuf *, int *, struct switch_flow_classify *); -struct mbuf - *switch_flow_classifier(struct mbuf *, uint32_t, - struct switch_flow_classify *); void switch_flow_classifier_dump(struct switch_softc *, struct switch_flow_classify *); void switchattach(int); diff --git a/sys/net/if_switch.h b/sys/net/if_switch.h index ff50da864ca..951bb7889ef 100644 --- a/sys/net/if_switch.h +++ b/sys/net/if_switch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.h,v 1.4 2016/10/07 08:18:22 rzalamena Exp $ */ +/* $OpenBSD: if_switch.h,v 1.5 2016/10/28 09:01:49 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -216,6 +216,9 @@ void switch_port_egress(struct switch_softc *, struct switch_fwdp_queue *, int switch_swfcl_dup(struct switch_flow_classify *, struct switch_flow_classify *); void switch_swfcl_free(struct switch_flow_classify *); +struct mbuf + *switch_flow_classifier(struct mbuf *, uint32_t, + struct switch_flow_classify *); /* switchctl.c */ void switch_dev_destroy(struct switch_softc *); diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c index 27d39a832e0..4c356c10018 100644 --- a/sys/net/switchofp.c +++ b/sys/net/switchofp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchofp.c,v 1.17 2016/10/27 09:48:01 jsg Exp $ */ +/* $OpenBSD: switchofp.c,v 1.18 2016/10/28 09:01:49 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -5084,7 +5084,7 @@ swofp_recv_packet_out(struct switch_softc *sc, struct mbuf *m) pout = mtod(m, struct ofp_packet_out *); al_start = offsetof(struct ofp_packet_out, pout_actions); - if (pout->pout_buffer_id != OFP_CONTROLLER_MAXLEN_NO_BUFFER) { + if (pout->pout_buffer_id == OFP_PKTOUT_NO_BUFFER) { /* * It's not necessary to deep copy at here because it's done * in m_dup_pkt(). @@ -5102,6 +5102,17 @@ swofp_recv_packet_out(struct switch_softc *sc, struct mbuf *m) } mc = mcn; + } else { + /* TODO We don't do buffering yet. */ + swofp_send_error(sc, m, OFP_ERRTYPE_BAD_REQUEST, + OFP_ERRREQ_BUFFER_UNKNOWN); + return (0); + } + + mc = switch_flow_classifier(mc, pout->pout_in_port, &swfcl); + if (mc == NULL) { + m_freem(m); + return (0); } TAILQ_INIT(&swpld.swpld_fwdp_q); |
