From 150138bd01a241304a93dbd1f731de2ad4316fe6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 28 Jul 2017 01:02:21 +0200 Subject: socket: move print function from compat Signed-off-by: Jason A. Donenfeld --- src/socket.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/socket.h') diff --git a/src/socket.h b/src/socket.h index 3e99683..4d9e5f5 100644 --- a/src/socket.h +++ b/src/socket.h @@ -21,4 +21,14 @@ int socket_endpoint_from_skb(struct endpoint *endpoint, struct sk_buff *skb); void socket_set_peer_endpoint(struct wireguard_peer *peer, struct endpoint *endpoint); void socket_clear_peer_endpoint_src(struct wireguard_peer *peer); +#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) +#define net_dbg_skb_ratelimited(fmt, dev, skb, ...) do { \ + struct endpoint __endpoint; \ + socket_endpoint_from_skb(&__endpoint, skb); \ + net_dbg_ratelimited(fmt, dev, &__endpoint.addr, ##__VA_ARGS__); \ +} while(0) +#else +#define net_dbg_skb_ratelimited(fmt, skb, ...) +#endif + #endif -- cgit v1.2.3