From 525fa911e8ab354dafe1e23fa98fac4700555be9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 20 Nov 2023 17:02:43 +0100 Subject: [PATCH] replace DPRINTF calls with D(...) This makes messages appear in udebug output Signed-off-by: Felix Fietkau --- config.c | 4 ++-- device.c | 8 ++++---- interface-ip.c | 12 ++++++------ interface.c | 4 ++-- iprule.c | 14 +++++++------- proto-shell.c | 6 +++--- ubus.c | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/config.c b/config.c index d4a6516..f0b1fb8 100644 --- a/config.c +++ b/config.c @@ -645,7 +645,7 @@ config_init_wireless(void) const char *dev_name; if (!uci_wireless) { - DPRINTF("No wireless configuration found\n"); + D(WIRELESS, "No wireless configuration found\n"); return; } @@ -678,7 +678,7 @@ config_init_wireless(void) wdev = vlist_find(&wireless_devices, dev_name, wdev, node); if (!wdev) { - DPRINTF("device %s not found!\n", dev_name); + D(WIRELESS, "device %s not found!\n", dev_name); continue; } diff --git a/device.c b/device.c index 1370335..199622f 100644 --- a/device.c +++ b/device.c @@ -400,7 +400,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (system_resolve_rpfilter(blobmsg_data(cur), &s->rpfilter)) s->flags |= DEV_OPT_RPFILTER; else - DPRINTF("Failed to resolve rpfilter: %s\n", (char *) blobmsg_data(cur)); + D(DEVICE, "Failed to resolve rpfilter: %s\n", (char *) blobmsg_data(cur)); } if ((cur = tb[DEV_ATTR_ACCEPTLOCAL])) { @@ -413,7 +413,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->igmpversion >= 1 && s->igmpversion <= 3) s->flags |= DEV_OPT_IGMPVERSION; else - DPRINTF("Failed to resolve igmpversion: %d\n", blobmsg_get_u32(cur)); + D(DEVICE, "Failed to resolve igmpversion: %d\n", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_MLDVERSION])) { @@ -421,7 +421,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->mldversion >= 1 && s->mldversion <= 2) s->flags |= DEV_OPT_MLDVERSION; else - DPRINTF("Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur)); + D(DEVICE, "Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_NEIGHREACHABLETIME])) { @@ -454,7 +454,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->multicast_router <= 2) s->flags |= DEV_OPT_MULTICAST_ROUTER; else - DPRINTF("Invalid value: %d - (Use 0: never, 1: learn, 2: always)\n", blobmsg_get_u32(cur)); + D(DEVICE, "Invalid value: %d - (Use 0: never, 1: learn, 2: always)\n", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_MULTICAST_FAST_LEAVE])) { diff --git a/interface-ip.c b/interface-ip.c index 28e7106..592b528 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -442,7 +442,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_TARGET]) != NULL) { if (!parse_ip_and_netmask(af, blobmsg_data(cur), &route->addr, &route->mask)) { - DPRINTF("Failed to parse route target: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse route target: %s\n", (char *) blobmsg_data(cur)); goto error; } @@ -453,7 +453,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_GATEWAY]) != NULL) { if (!inet_pton(af, blobmsg_data(cur), &route->nexthop)) { - DPRINTF("Failed to parse route gateway: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse route gateway: %s\n", (char *) blobmsg_data(cur)); goto error; } } @@ -477,7 +477,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) const char *mask = strtok_r(NULL, "/", &saveptr); if (!addr || inet_pton(af, addr, &route->source) < 1) { - DPRINTF("Failed to parse route source: %s\n", addr ? addr : "NULL"); + D(INTERFACE, "Failed to parse route source: %s\n", addr ? addr : "NULL"); goto error; } @@ -489,7 +489,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_TABLE]) != NULL) { if (!system_resolve_rt_table(blobmsg_data(cur), &route->table)) { - DPRINTF("Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); goto error; } @@ -510,7 +510,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_TYPE]) != NULL) { if (!system_resolve_rt_type(blobmsg_data(cur), &route->type)) { - DPRINTF("Failed to resolve routing type: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing type: %s\n", (char *) blobmsg_data(cur)); goto error; } route->flags |= DEVROUTE_TYPE; @@ -518,7 +518,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_PROTO]) != NULL) { if (!system_resolve_rt_proto(blobmsg_data(cur), &route->proto)) { - DPRINTF("Failed to resolve proto type: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve proto type: %s\n", (char *) blobmsg_data(cur)); goto error; } route->flags |= DEVROUTE_PROTO; diff --git a/interface.c b/interface.c index 03c781b..2237b78 100644 --- a/interface.c +++ b/interface.c @@ -911,12 +911,12 @@ interface_alloc(const char *name, struct blob_attr *config, bool dynamic) if ((cur = tb[IFACE_ATTR_IP4TABLE])) { if (!system_resolve_rt_table(blobmsg_data(cur), &iface->ip4table)) - DPRINTF("Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); } if ((cur = tb[IFACE_ATTR_IP6TABLE])) { if (!system_resolve_rt_table(blobmsg_data(cur), &iface->ip6table)) - DPRINTF("Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); } iface->proto_ip.no_delegation = !blobmsg_get_bool_default(tb[IFACE_ATTR_DELEGATE], true); diff --git a/iprule.c b/iprule.c index 0956073..19284b7 100644 --- a/iprule.c +++ b/iprule.c @@ -236,7 +236,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_SRC]) != NULL) { if (!parse_ip_and_netmask(af, blobmsg_data(cur), &rule->src_addr, &rule->src_mask)) { - DPRINTF("Failed to parse rule source: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule source: %s\n", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_SRC; @@ -244,7 +244,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_DEST]) != NULL) { if (!parse_ip_and_netmask(af, blobmsg_data(cur), &rule->dest_addr, &rule->dest_mask)) { - DPRINTF("Failed to parse rule destination: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule destination: %s\n", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_DEST; @@ -257,7 +257,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_TOS]) != NULL) { if ((rule->tos = blobmsg_get_u32(cur)) > 255) { - DPRINTF("Invalid TOS value: %u\n", blobmsg_get_u32(cur)); + D(INTERFACE, "Invalid TOS value: %u\n", blobmsg_get_u32(cur)); goto error; } rule->flags |= IPRULE_TOS; @@ -265,7 +265,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_FWMARK]) != NULL) { if (!iprule_parse_mark(blobmsg_data(cur), rule)) { - DPRINTF("Failed to parse rule fwmark: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule fwmark: %s\n", (char *) blobmsg_data(cur)); goto error; } /* flags set by iprule_parse_mark() */ @@ -273,7 +273,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_LOOKUP]) != NULL) { if (!system_resolve_rt_table(blobmsg_data(cur), &rule->lookup)) { - DPRINTF("Failed to parse rule lookup table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule lookup table: %s\n", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_LOOKUP; @@ -290,7 +290,7 @@ iprule_add(struct blob_attr *attr, bool v6) if (ret == 1) rule->uidrange_end = rule->uidrange_start; else if (ret != 2) { - DPRINTF("Failed to parse UID range: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse UID range: %s\n", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_UIDRANGE; @@ -298,7 +298,7 @@ iprule_add(struct blob_attr *attr, bool v6) if ((cur = tb[RULE_ACTION]) != NULL) { if (!system_resolve_iprule_action(blobmsg_data(cur), &rule->action)) { - DPRINTF("Failed to parse rule action: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule action: %s\n", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_ACTION; diff --git a/proto-shell.c b/proto-shell.c index bc3c41d..2139806 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -405,7 +405,7 @@ proto_shell_parse_route_list(struct interface *iface, struct blob_attr *attr, blobmsg_for_each_attr(cur, attr, rem) { if (blobmsg_type(cur) != BLOBMSG_TYPE_TABLE) { - DPRINTF("Ignore wrong route type: %d\n", blobmsg_type(cur)); + D(INTERFACE, "Ignore wrong route type: %d\n", blobmsg_type(cur)); continue; } @@ -422,7 +422,7 @@ proto_shell_parse_neighbor_list(struct interface *iface, struct blob_attr *attr, blobmsg_for_each_attr(cur, attr, rem) { if (blobmsg_type(cur) != BLOBMSG_TYPE_TABLE) { - DPRINTF("Ignore wrong neighbor type: %d\n", blobmsg_type(cur)); + D(INTERFACE, "Ignore wrong neighbor type: %d\n", blobmsg_type(cur)); continue; } @@ -936,7 +936,7 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj) if (config) handler->config_buf = netifd_handler_parse_config(&handler->config, config); - DPRINTF("Add handler for script %s: %s\n", script, proto->name); + D(INTERFACE, "Add handler for script %s: %s\n", script, proto->name); add_proto_handler(proto); } diff --git a/ubus.c b/ubus.c index 8ac395f..55daec1 100644 --- a/ubus.c +++ b/ubus.c @@ -435,12 +435,12 @@ netifd_ubus_reconnect_timer(struct uloop_timeout *timeout) int t = 2; if (ubus_reconnect(ubus_ctx, ubus_path) != 0) { - DPRINTF("failed to reconnect, trying again in %d seconds\n", t); + D(SYSTEM, "failed to reconnect, trying again in %d seconds\n", t); uloop_timeout_set(&retry, t * 1000); return; } - DPRINTF("reconnected to ubus, new id: %08x\n", ubus_ctx->local_id); + D(SYSTEM, "reconnected to ubus, new id: %08x\n", ubus_ctx->local_id); netifd_ubus_add_fd(); } @@ -1441,7 +1441,7 @@ netifd_ubus_init(const char *path) if (!ubus_ctx) return -EIO; - DPRINTF("connected as %08x\n", ubus_ctx->local_id); + D(SYSTEM, "connected as %08x\n", ubus_ctx->local_id); ubus_ctx->connection_lost = netifd_ubus_connection_lost; netifd_ubus_add_fd(); @@ -1501,7 +1501,7 @@ netifd_ubus_add_interface(struct interface *iface) obj->methods = iface_object_methods; obj->n_methods = ARRAY_SIZE(iface_object_methods); if (ubus_add_object(ubus_ctx, &iface->ubus)) { - DPRINTF("failed to publish ubus object for interface '%s'\n", iface->name); + D(SYSTEM, "failed to publish ubus object for interface '%s'\n", iface->name); free(name); obj->name = NULL; } -- 2.30.2