summaryrefslogtreecommitdiffhomepage
path: root/src/socket.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-07-28 01:02:21 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-07-28 01:02:21 +0200
commit150138bd01a241304a93dbd1f731de2ad4316fe6 (patch)
tree3453a27b8dae13d36dfaca6bca60e60f1636d595 /src/socket.h
parent83477092d2f93970974c75c890157eb34db48b9b (diff)
socket: move print function from compat
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/socket.h')
-rw-r--r--src/socket.h10
1 files changed, 10 insertions, 0 deletions
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