aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-22 11:46:41 +0200
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-22 11:46:41 +0200
commit7aec6fa02ecd474cd74a6b4d79417cd1fe8746c5 (patch)
tree36276fe885e2d1c77ad948fff926f1ab44d2bcfc
parentUse mpq for the transmit queue (diff)
downloadwireguard-openbsd-7aec6fa02ecd474cd74a6b4d79417cd1fe8746c5.tar.xz
wireguard-openbsd-7aec6fa02ecd474cd74a6b4d79417cd1fe8746c5.zip
Reduce wg_mbuf_ratelimit args
-rw-r--r--src/if_wg.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index 3e1a704..96dd802 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -134,8 +134,7 @@ int wg_softc_route_add(struct wg_softc *, struct wg_cidr *,
int wg_softc_route_delete(struct wg_softc *, struct wg_cidr *);
struct wg_peer *wg_softc_route_lookup(struct wg_softc *, struct mbuf *, bool);
-int wg_mbuf_ratelimit(struct wg_softc *, struct mbuf *,
- union wg_ip *);
+int wg_mbuf_ratelimit(struct wg_softc *, struct mbuf *);
struct wg_tag *wg_mbuf_get_tag(struct mbuf *);
int wg_peer_cmp(struct wg_peer *, struct wg_peer *);
@@ -347,12 +346,14 @@ wg_softc_route_lookup(struct wg_softc * sc, struct mbuf * m, bool out)
}
int
-wg_mbuf_ratelimit(struct wg_softc *sc, struct mbuf *m, union wg_ip *ip)
+wg_mbuf_ratelimit(struct wg_softc *sc, struct mbuf *m)
{
enum wg_error e;
struct wg_cookie c;
struct wg_msg_response *resp;
struct wg_msg_initiation *init;
+ struct wg_tag *tag = wg_mbuf_get_tag(m);
+ union wg_ip *ip = &tag->t_ip;
uint8_t *mac, *token, token_len;
uint32_t sender;
@@ -636,7 +637,7 @@ wg_softc_recv_initiation(struct wg_softc *sc, struct mbuf *m)
struct wg_tag *tag = wg_mbuf_get_tag(m);
struct wg_msg_initiation *init = mtod(m, struct wg_msg_initiation *);
- if (wg_mbuf_ratelimit(sc, m, &tag->t_ip)) {
+ if (wg_mbuf_ratelimit(sc, m)) {
DPRINTF(sc, "dropped initiation");
return;
}
@@ -672,7 +673,7 @@ wg_softc_recv_response(struct wg_softc *sc, struct mbuf *m)
struct wg_tag *tag = wg_mbuf_get_tag(m);
struct wg_msg_response *resp = mtod(m, struct wg_msg_response *);
- if (wg_mbuf_ratelimit(sc, m, &tag->t_ip)) {
+ if (wg_mbuf_ratelimit(sc, m)) {
DPRINTF(sc, "dropped response");
return;
}