]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ovpn: improve 'no route to host' debug message
authorAntonio Quartulli <antonio@openvpn.net>
Fri, 9 May 2025 13:32:13 +0000 (15:32 +0200)
committerAntonio Quartulli <antonio@openvpn.net>
Thu, 15 May 2025 11:09:36 +0000 (13:09 +0200)
When debugging a 'no route to host' error it can be beneficial
to know the address of the unreachable destination.
Print it along the debugging text.

While at it, add a missing parenthesis in a different debugging
message inside ovpn_peer_endpoints_update().

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
drivers/net/ovpn/io.c
drivers/net/ovpn/peer.c

index 43f428ac112e6429883bc60a022f4d106cb75318..10d8afecec55302b7bacd4fb1962de1cc86460d8 100644 (file)
@@ -394,8 +394,18 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)
        /* retrieve peer serving the destination IP of this packet */
        peer = ovpn_peer_get_by_dst(ovpn, skb);
        if (unlikely(!peer)) {
-               net_dbg_ratelimited("%s: no peer to send data to\n",
-                                   netdev_name(ovpn->dev));
+               switch (skb->protocol) {
+               case htons(ETH_P_IP):
+                       net_dbg_ratelimited("%s: no peer to send data to dst=%pI4\n",
+                                           netdev_name(ovpn->dev),
+                                           &ip_hdr(skb)->daddr);
+                       break;
+               case htons(ETH_P_IPV6):
+                       net_dbg_ratelimited("%s: no peer to send data to dst=%pI6c\n",
+                                           netdev_name(ovpn->dev),
+                                           &ipv6_hdr(skb)->daddr);
+                       break;
+               }
                goto drop;
        }
        /* dst was needed for peer selection - it can now be dropped */
index 24eb9d81429ee652d7106db9e0ea7fa60430cce5..a1fd27b9c038a34a1a2dd064f25afc0b7eab0f26 100644 (file)
@@ -258,7 +258,7 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb)
                 */
                if (unlikely(!ipv6_addr_equal(&bind->local.ipv6,
                                              &ipv6_hdr(skb)->daddr))) {
-                       net_dbg_ratelimited("%s: learning local IPv6 for peer %d (%pI6c -> %pI6c\n",
+                       net_dbg_ratelimited("%s: learning local IPv6 for peer %d (%pI6c -> %pI6c)\n",
                                            netdev_name(peer->ovpn->dev),
                                            peer->id, &bind->local.ipv6,
                                            &ipv6_hdr(skb)->daddr);