summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-12-31 11:28:27 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2021-01-12 23:34:17 +0100
commit7280c6f0469af86f3a587858d4126033347deb32 (patch)
treeaa67f745804b9f8d3e3303fe7d2d56f028a6faee
parentf83dfc0e217e7cd2bcbf278987bbc0b5ed6d4236 (diff)
Wireguard: Replace debug with DBG
-rw-r--r--proto/wireguard/wireguard.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c
index da80d9f7..3cb598a8 100644
--- a/proto/wireguard/wireguard.c
+++ b/proto/wireguard/wireguard.c
@@ -46,7 +46,7 @@ int get_device(struct wg_proto *p, wg_device **pdev, const char *device_name)
if (c->listen_port)
dev->flags |= WGDEVICE_HAS_LISTEN_PORT;
dev->listen_port = c->listen_port;
- debug("listen port %d\n", c->listen_port);
+ DBG("listen port %d\n", c->listen_port);
struct peer_config *pc = NULL;
WALK_LIST(pc,c->peers)
@@ -117,7 +117,7 @@ static void
wg_init_entry(void *e_)
{
struct wg_entry *e UNUSED = e_;
-// debug("wg_init_entry\n");
+// DBG("wg_init_entry\n");
memset(e, 0, sizeof(struct wg_entry) - sizeof(struct fib_node));
}
@@ -125,7 +125,7 @@ wg_init_entry(void *e_)
static void
wg_postconfig(struct proto_config *C UNUSED)
{
- debug("postconfig\n");
+ DBG("postconfig\n");
}
static void
@@ -134,15 +134,15 @@ wg_if_notify(struct proto *P, unsigned flags, struct iface *i)
struct wg_proto *p = (struct wg_proto *) P;
struct wg_config *c = (struct wg_config *) P->cf;
- debug("WG: if_notify %p %s %d %s\n", i, i->name, flags, c->ifname);
+ DBG("WG: if_notify %p %s %d %s\n", i, i->name, flags, c->ifname);
if (c->ifname && !strcmp(i->name, c->ifname)) {
- debug("WG: found ifname\n");
+ DBG("WG: found ifname\n");
p->iface = i;
}
if (flags & IF_CHANGE_UP)
{
- debug("WG: IF_CHANGE_UP %s\n", i->name);
+ DBG("WG: IF_CHANGE_UP %s\n", i->name);
int res = set_device(p);
log(L_TRACE "WG: wg_set_device %d", res);
@@ -165,13 +165,13 @@ dump_peer(struct wg_peer *peer)
{
wg_key_b64_string base64;
wg_key_to_base64(base64, peer->public_key);
- debug("WG: peer %s\n", base64);
+ DBG("WG: peer %s\n", base64);
struct wg_allowedip *allowedip = NULL;
wg_for_each_allowedip(peer, allowedip) {
ip_addr ip = allowedip_to_ipa(allowedip);
- debug("allowedip %I/%d\n", ip, allowedip->cidr);
+ DBG("allowedip %I/%d\n", ip, allowedip->cidr);
}
}
@@ -202,14 +202,14 @@ remove_marked_peer(wg_device *dev)
wg_for_each_peer(dev, peer) {
if (peer->flags & WGPEER_REMOVE_ME) {
if (!prevpeer) {
- debug("WG: remove first peer\n");
+ DBG("WG: remove first peer\n");
dev->first_peer = peer->next_peer;
if (dev->last_peer == peer) {
dev->last_peer = NULL;
dev->first_peer = NULL;
}
} else {
- debug("WG: remove middle peer\n");
+ DBG("WG: remove middle peer\n");
// Remove
if (dev->last_peer == peer)
dev->last_peer = prevpeer;
@@ -301,36 +301,36 @@ remove_allowed_ip(wg_peer *peer, struct wg_allowedip *allowedip)
wg_for_each_allowedip(peer, ip) {
if (allowedip->family != ip->family) {
- debug("WG: family no match\n");
+ DBG("WG: family no match\n");
previp = ip;
continue;
}
if (allowedip->cidr != ip->cidr) {
- debug("WG: cidr no match\n");
+ DBG("WG: cidr no match\n");
previp = ip;
continue;
}
if (memcmp(&allowedip->ip6, &ip->ip6, sizeof(struct in6_addr))) {
- debug("WG: ip no match\n");
+ DBG("WG: ip no match\n");
dump(&allowedip->ip6, sizeof(struct in6_addr));
dump(&ip->ip6, sizeof(struct in6_addr));
previp = ip;
continue;
}
- debug("WG: found ip\n");
+ DBG("WG: found ip\n");
if (!previp) {
- debug("WG: remove first\n");
+ DBG("WG: remove first\n");
peer->first_allowedip = ip->next_allowedip;
if (peer->last_allowedip == ip) {
peer->last_allowedip = NULL;
peer->first_allowedip = NULL;
}
} else {
- debug("WG: remove middle\n");
+ DBG("WG: remove middle\n");
// Remove
if (peer->last_allowedip == ip)
peer->last_allowedip = previp;
@@ -355,7 +355,7 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n,
struct iface *iface = NULL;
const char *ifname = NULL;
-// debug("WG: notify\n");
+// DBG("WG: notify\n");
if (new) {
struct nexthop *nh = &new->attrs->nh;
@@ -365,17 +365,17 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n,
if (iface && iface == p->iface) {
struct eattr *t;
- debug("WG: found %p iface %I %p\n", new->attrs, nh->gw, nh->next);
+ DBG("WG: found %p iface %I %p\n", new->attrs, nh->gw, nh->next);
struct hostentry *he = new->attrs->hostentry;
- debug("WG: he %p src %p\n", he, he?he->src:NULL);
+ DBG("WG: he %p src %p\n", he, he?he->src:NULL);
if (he && he->src) {
struct eattr *t = ea_find(he->src->eattrs, EA_CODE(PROTOCOL_BGP, BA_TUNNEL_ENCAP));
- debug("WG: he %p %I %I %p %p %I\n", t, he->addr, he->link, he->next, he->src->hostentry, he->src->nh.gw);
+ DBG("WG: he %p %I %I %p %p %I\n", t, he->addr, he->link, he->next, he->src->hostentry, he->src->nh.gw);
}
- debug("WG: notify new %d %N\n",
+ DBG("WG: notify new %d %N\n",
new->attrs->dest, n->n.addr);
bool is_tunnel_ep = false;
@@ -503,14 +503,14 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n,
}
} else {
- debug("WG: notify withdraw %N\n",
+ DBG("WG: notify withdraw %N\n",
n->n.addr);
/* Withdraw */
struct wg_entry *en = fib_find(&ch->rtable, n->n.addr);
if (!en) { // || en->valid != RIP_ENTRY_VALID)
- debug("WG: fib not found\n");
+ DBG("WG: fib not found\n");
return;
}
@@ -593,7 +593,7 @@ wg_reload_routes(struct channel *C)
{
struct wg_proto *p UNUSED = (struct wg_proto *) C->proto;
- debug("reload routes\n");
+ DBG("reload routes\n");
// TODO
// WALK_LIST(c, p->channels)
@@ -608,7 +608,7 @@ wg_init(struct proto_config *C)
struct proto *P = proto_new(C);
struct wg_proto *p UNUSED = (struct wg_proto *) P;
- debug("init\n");
+ DBG("init\n");
P->if_notify = wg_if_notify;
P->rt_notify = wg_rt_notify;
@@ -675,7 +675,7 @@ wg_dump(struct proto *P)
FIB_WALK(&ch->rtable, struct wg_entry, en)
{
// struct wg_entry *en = (struct wg_entry *) e;
- debug("WG: entry #%d:\n",
+ DBG("WG: entry #%d:\n",
i++);
}
FIB_WALK_END;
@@ -716,7 +716,7 @@ wg_copy_config(struct proto_config *DEST, struct proto_config *SRC)
struct peer_config *peer_new(struct wg_config *c)
{
struct peer_config *pc = cfg_allocz(sizeof(struct peer_config));
- debug("peer_new %p\n", pc);
+ DBG("peer_new %p\n", pc);
add_tail(&c->peers, (node*)pc);
return pc;
}