From: Felix Fietkau Date: Tue, 5 Dec 2023 10:28:57 +0000 (+0100) Subject: debug: remove newline from debug messages X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=061e308f9f7d30b0bc490d93e113ee763ecb06a1;p=project%2Fnetifd.git debug: remove newline from debug messages Signed-off-by: Felix Fietkau --- diff --git a/bonding.c b/bonding.c index 532308c..3b25751 100644 --- a/bonding.c +++ b/bonding.c @@ -244,7 +244,7 @@ bonding_enable_port(struct bonding_port *bp) ret = system_bonding_set_port(&bdev->dev, bp->dev.dev, true, bp->set_primary); if (ret < 0) { - D(DEVICE, "Bonding port %s could not be added\n", bp->dev.dev->ifname); + D(DEVICE, "Bonding port %s could not be added", bp->dev.dev->ifname); goto error; } diff --git a/bridge.c b/bridge.c index dd4d2c1..c931923 100644 --- a/bridge.c +++ b/bridge.c @@ -617,7 +617,7 @@ bridge_enable_member(struct bridge_member *bm) if (!bm->active) { ret = system_bridge_addif(&bst->dev, bm->dev.dev); if (ret < 0) { - D(DEVICE, "Bridge device %s could not be added\n", bm->dev.dev->ifname); + D(DEVICE, "Bridge device %s could not be added", bm->dev.dev->ifname); goto error; } @@ -1282,7 +1282,7 @@ bridge_reload(struct device *dev, struct blob_attr *attr) uci_blob_diff(tb_dev, otb_dev, &device_attr_list, diff); if (diff[0] | diff[1]) { ret = DEV_CONFIG_RESTART; - D(DEVICE, "Bridge %s device attributes have changed, diff=[%lx %lx]\n", + D(DEVICE, "Bridge %s device attributes have changed, diff=[%lx %lx]", dev->ifname, diff[1], diff[0]); } @@ -1293,7 +1293,7 @@ bridge_reload(struct device *dev, struct blob_attr *attr) uci_blob_diff(tb_br, otb_br, &bridge_attr_list, diff); if (diff[0] & ~(1 << BRIDGE_ATTR_PORTS)) { ret = DEV_CONFIG_RESTART; - D(DEVICE, "Bridge %s attributes have changed, diff=[%lx %lx]\n", + D(DEVICE, "Bridge %s attributes have changed, diff=[%lx %lx]", dev->ifname, diff[1], diff[0]); } diff --git a/config.c b/config.c index f0b1fb8..a7f9c0b 100644 --- a/config.c +++ b/config.c @@ -146,7 +146,7 @@ config_parse_bridge_interface(struct uci_section *s, struct device_type *devtype config_fixup_bridge_vlan_filtering(s, name); uci_to_blob(&b, s, devtype->config_params); if (!device_create(name, devtype, b.head)) { - D(INTERFACE, "Failed to create '%s' device for interface '%s'\n", + D(INTERFACE, "Failed to create '%s' device for interface '%s'", devtype->name, s->e.name); } @@ -645,7 +645,7 @@ config_init_wireless(void) const char *dev_name; if (!uci_wireless) { - D(WIRELESS, "No wireless configuration found\n"); + D(WIRELESS, "No wireless configuration found"); return; } @@ -678,7 +678,7 @@ config_init_wireless(void) wdev = vlist_find(&wireless_devices, dev_name, wdev, node); if (!wdev) { - D(WIRELESS, "device %s not found!\n", dev_name); + D(WIRELESS, "device %s not found!", dev_name); continue; } diff --git a/device.c b/device.c index 839f7ec..b352ee3 100644 --- a/device.c +++ b/device.c @@ -403,7 +403,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 - D(DEVICE, "Failed to resolve rpfilter: %s\n", (char *) blobmsg_data(cur)); + D(DEVICE, "Failed to resolve rpfilter: %s", (char *) blobmsg_data(cur)); } if ((cur = tb[DEV_ATTR_ACCEPTLOCAL])) { @@ -416,7 +416,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->igmpversion >= 1 && s->igmpversion <= 3) s->flags |= DEV_OPT_IGMPVERSION; else - D(DEVICE, "Failed to resolve igmpversion: %d\n", blobmsg_get_u32(cur)); + D(DEVICE, "Failed to resolve igmpversion: %d", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_MLDVERSION])) { @@ -424,7 +424,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->mldversion >= 1 && s->mldversion <= 2) s->flags |= DEV_OPT_MLDVERSION; else - D(DEVICE, "Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur)); + D(DEVICE, "Failed to resolve mldversion: %d", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_NEIGHREACHABLETIME])) { @@ -457,7 +457,7 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if (s->multicast_router <= 2) s->flags |= DEV_OPT_MULTICAST_ROUTER; else - D(DEVICE, "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)", blobmsg_get_u32(cur)); } if ((cur = tb[DEV_ATTR_MULTICAST_FAST_LEAVE])) { @@ -683,7 +683,7 @@ int device_claim(struct device_user *dep) return -1; dep->claimed = true; - D(DEVICE, "Claim %s %s, new active count: %d\n", dev->type->name, dev->ifname, dev->active + 1); + D(DEVICE, "Claim %s %s, new active count: %d", dev->type->name, dev->ifname, dev->active + 1); if (++dev->active != 1) return 0; @@ -703,7 +703,7 @@ int device_claim(struct device_user *dep) if (ret == 0) device_broadcast_event(dev, DEV_EVENT_UP); else { - D(DEVICE, "claim %s %s failed: %d\n", dev->type->name, dev->ifname, ret); + D(DEVICE, "claim %s %s failed: %d", dev->type->name, dev->ifname, ret); dev->active = 0; dep->claimed = false; } @@ -720,7 +720,7 @@ void device_release(struct device_user *dep) dep->claimed = false; dev->active--; - D(DEVICE, "Release %s %s, new active count: %d\n", dev->type->name, dev->ifname, dev->active); + D(DEVICE, "Release %s %s, new active count: %d", dev->type->name, dev->ifname, dev->active); assert(dev->active >= 0); if (dev->active) @@ -749,7 +749,7 @@ int device_init_virtual(struct device *dev, struct device_type *type, const char assert(dev); assert(type); - D(DEVICE, "Initialize device '%s'\n", name ? name : ""); + D(DEVICE, "Initialize device '%s'", name ? name : ""); INIT_SAFE_LIST(&dev->users); INIT_SAFE_LIST(&dev->aliases); dev->type = type; @@ -795,7 +795,7 @@ device_create_default(const char *name, bool external) if (!external && system_if_force_external(name)) return NULL; - D(DEVICE, "Create simple device '%s'\n", name); + D(DEVICE, "Create simple device '%s'", name); dev = calloc(1, sizeof(*dev)); if (!dev) return NULL; @@ -860,7 +860,7 @@ device_delete(struct device *dev) if (!dev->avl.key) return; - D(DEVICE, "Delete device '%s' from list\n", dev->ifname); + D(DEVICE, "Delete device '%s' from list", dev->ifname); avl_delete(&devices, &dev->avl); dev->avl.key = NULL; } @@ -877,7 +877,7 @@ static int device_cleanup_cb(void *ctx, struct safe_list *list) void device_cleanup(struct device *dev) { - D(DEVICE, "Clean up device '%s'\n", dev->ifname); + D(DEVICE, "Clean up device '%s'", dev->ifname); safe_list_for_each(&dev->users, device_cleanup_cb, NULL); safe_list_for_each(&dev->aliases, device_cleanup_cb, NULL); device_delete(dev); @@ -938,7 +938,7 @@ void device_set_present(struct device *dev, bool state) if (dev->sys_present == state) return; - D(DEVICE, "%s '%s' %s present\n", dev->type->name, dev->ifname, state ? "is now" : "is no longer" ); + D(DEVICE, "%s '%s' %s present", dev->type->name, dev->ifname, state ? "is now" : "is no longer" ); dev->sys_present = state; if (!state) __device_set_present(dev, state, true); @@ -1021,7 +1021,7 @@ __device_add_user(struct device_user *dep, struct device *dev) head = &dev->users; safe_list_add(&dep->list, head); - D(DEVICE, "Add user for device '%s', refcount=%d\n", dev->ifname, device_refcount(dev)); + D(DEVICE, "Add user for device '%s', refcount=%d", dev->ifname, device_refcount(dev)); if (dep->cb && dev->present) { dep->cb(dep, DEV_EVENT_ADD); @@ -1097,7 +1097,7 @@ void device_remove_user(struct device_user *dep) safe_list_del(&dep->list); dep->dev = NULL; - D(DEVICE, "Remove user for device '%s', refcount=%d\n", dev->ifname, device_refcount(dev)); + D(DEVICE, "Remove user for device '%s', refcount=%d", dev->ifname, device_refcount(dev)); device_free_unused(); } @@ -1172,7 +1172,7 @@ device_apply_config(struct device *dev, struct device_type *type, switch (change) { case DEV_CONFIG_RESTART: case DEV_CONFIG_APPLIED: - D(DEVICE, "Device '%s': config applied\n", dev->ifname); + D(DEVICE, "Device '%s': config applied", dev->ifname); config = blob_memdup(config); free(dev->config); dev->config = config; @@ -1190,7 +1190,7 @@ device_apply_config(struct device *dev, struct device_type *type, } break; case DEV_CONFIG_NO_CHANGE: - D(DEVICE, "Device '%s': no configuration change\n", dev->ifname); + D(DEVICE, "Device '%s': no configuration change", dev->ifname); break; case DEV_CONFIG_RECREATE: break; @@ -1264,14 +1264,14 @@ device_create(const char *name, struct device_type *type, change = device_apply_config(odev, type, config); switch (change) { case DEV_CONFIG_RECREATE: - D(DEVICE, "Device '%s': recreate device\n", odev->ifname); + D(DEVICE, "Device '%s': recreate device", odev->ifname); device_delete(odev); break; default: return odev; } } else - D(DEVICE, "Create new device '%s' (%s)\n", name, type->name); + D(DEVICE, "Create new device '%s' (%s)", name, type->name); config = blob_memdup(config); if (!config) diff --git a/extdev.c b/extdev.c index 8d06228..e2e3a91 100644 --- a/extdev.c +++ b/extdev.c @@ -128,7 +128,7 @@ static const char *__extdev_methods[__METHODS_MAX] = { static inline int netifd_extdev_create(struct extdev_device *edev, struct blob_attr *msg) { - D(DEVICE, "create %s '%s' at external device handler\n", edev->dev.type->name, + D(DEVICE, "create %s '%s' at external device handler", edev->dev.type->name, edev->dev.ifname); return netifd_extdev_invoke(edev->etype->peer_id, __extdev_methods[METHOD_CREATE], msg, NULL, NULL); @@ -137,7 +137,7 @@ netifd_extdev_create(struct extdev_device *edev, struct blob_attr *msg) static inline int netifd_extdev_reload(struct extdev_device *edev, struct blob_attr *msg) { - D(DEVICE, "reload %s '%s' at external device handler\n", edev->dev.type->name, + D(DEVICE, "reload %s '%s' at external device handler", edev->dev.type->name, edev->dev.ifname); return netifd_extdev_invoke(edev->etype->peer_id, __extdev_methods[METHOD_RELOAD], msg, NULL, NULL); @@ -146,7 +146,7 @@ netifd_extdev_reload(struct extdev_device *edev, struct blob_attr *msg) static inline int netifd_extdev_free(struct extdev_device *edev, struct blob_attr *msg) { - D(DEVICE, "delete %s '%s' with external device handler\n", edev->dev.type->name, + D(DEVICE, "delete %s '%s' with external device handler", edev->dev.type->name, edev->dev.ifname); return netifd_extdev_invoke(edev->etype->peer_id, __extdev_methods[METHOD_FREE], msg, NULL, NULL); @@ -155,7 +155,7 @@ netifd_extdev_free(struct extdev_device *edev, struct blob_attr *msg) static inline int netifd_extdev_prepare(struct extdev_bridge *ebr, struct blob_attr *msg) { - D(DEVICE, "prepare %s bridge '%s' at external device handler\n", ebr->edev.dev.type->name, + D(DEVICE, "prepare %s bridge '%s' at external device handler", ebr->edev.dev.type->name, ebr->edev.dev.ifname); return netifd_extdev_invoke(ebr->edev.etype->peer_id, __extdev_methods[METHOD_HOTPLUG_PREPARE], msg, NULL, NULL); @@ -164,7 +164,7 @@ netifd_extdev_prepare(struct extdev_bridge *ebr, struct blob_attr *msg) static inline int netifd_extdev_add(struct extdev_bridge *ebr, struct blob_attr *msg) { - D(DEVICE, "add a member to %s bridge '%s' at external device handler\n", + D(DEVICE, "add a member to %s bridge '%s' at external device handler", ebr->edev.dev.type->name, ebr->edev.dev.ifname); return netifd_extdev_invoke(ebr->edev.etype->peer_id, __extdev_methods[METHOD_HOTPLUG_ADD], msg,NULL, NULL); @@ -173,7 +173,7 @@ netifd_extdev_add(struct extdev_bridge *ebr, struct blob_attr *msg) static inline int netifd_extdev_remove(struct extdev_bridge *ebr, struct blob_attr *msg) { - D(DEVICE, "remove a member from %s bridge '%s' at external device handler\n", + D(DEVICE, "remove a member from %s bridge '%s' at external device handler", ebr->edev.dev.type->name, ebr->edev.dev.ifname); return netifd_extdev_invoke(ebr->edev.etype->peer_id, __extdev_methods[METHOD_HOTPLUG_REMOVE], msg, NULL, NULL); @@ -319,7 +319,7 @@ extdev_bridge_enable_member(struct extdev_bridge_member *ubm) int ret; struct extdev_bridge *ebr = ubm->parent_br; - D(DEVICE, "%s enable member %s\n", ebr->edev.dev.ifname, ubm->name); + D(DEVICE, "%s enable member %s", ebr->edev.dev.ifname, ubm->name); if (!ubm->present) return 0; @@ -351,7 +351,7 @@ extdev_bridge_enable_member(struct extdev_bridge_member *ubm) return 0; error: - D(DEVICE, "%s: failed to enable member '%s'\n", ebr->edev.dev.ifname, ubm->name); + D(DEVICE, "%s: failed to enable member '%s'", ebr->edev.dev.ifname, ubm->name); ebr->n_failed++; ubm->present = false; @@ -369,7 +369,7 @@ extdev_bridge_disable_member(struct extdev_bridge_member *ubm) if (!ubm->present) return 0; - D(DEVICE, "%s disable member %s\n", ubm->parent_br->edev.dev.ifname, ubm->name); + D(DEVICE, "%s disable member %s", ubm->parent_br->edev.dev.ifname, ubm->name); blob_buf_init(&b, 0); blobmsg_add_string(&b, "bridge", ebr->edev.dev.ifname); @@ -398,7 +398,7 @@ error: static int extdev_bridge_set_down(struct extdev_bridge *ebr) { - D(DEVICE, "set %s bridge %s down\n", ebr->edev.dev.type->name, ebr->edev.dev.ifname); + D(DEVICE, "set %s bridge %s down", ebr->edev.dev.type->name, ebr->edev.dev.ifname); struct extdev_bridge_member *ubm; @@ -424,7 +424,7 @@ extdev_bridge_check_retry(struct extdev_bridge *ebr) static int extdev_bridge_set_up(struct extdev_bridge *ebr) { - D(DEVICE, "set %s bridge %s up\n", ebr->edev.dev.type->name, ebr->edev.dev.ifname); + D(DEVICE, "set %s bridge %s up", ebr->edev.dev.type->name, ebr->edev.dev.ifname); struct extdev_bridge_member *ubm; int ret; @@ -571,7 +571,7 @@ extdev_bridge_retry_enable_members(struct uloop_timeout *timeout) { struct extdev_bridge *ebr = container_of(timeout, struct extdev_bridge, retry); - D(DEVICE, "%s retry enable members\n", ebr->edev.dev.ifname); + D(DEVICE, "%s retry enable members", ebr->edev.dev.ifname); __bridge_enable_members(ebr); } @@ -605,7 +605,7 @@ extdev_bridge_create_member(struct extdev_bridge *ebr, struct device *dev) static void extdev_bridge_add_member(struct extdev_bridge *ebr, const char *name) { - D(DEVICE, "%s add member %s\n", ebr->edev.dev.ifname, name); + D(DEVICE, "%s add member %s", ebr->edev.dev.ifname, name); struct device *dev; @@ -620,7 +620,7 @@ extdev_bridge_add_member(struct extdev_bridge *ebr, const char *name) static int extdev_hotplug_add(struct device *ebr_dev, struct device *ebm_dev, struct blob_attr *vlan) { - D(DEVICE, "%s hotplug add member %s\n", ebr_dev->ifname, ebm_dev->ifname); + D(DEVICE, "%s hotplug add member %s", ebr_dev->ifname, ebm_dev->ifname); struct extdev_bridge *ebr; struct extdev_bridge_member *ubm; @@ -848,7 +848,7 @@ __bridge_reload(struct extdev_bridge *ebr, struct blob_attr *config) if (ebr->edev.dep_name) { dev = device_get(ebr->edev.dep_name, 0); if (!(dev && dev->current_config)) { - D(DEVICE, "%s: cannot yet init config since dependency '%s' is not ready\n", + D(DEVICE, "%s: cannot yet init config since dependency '%s' is not ready", ebr->edev.dev.ifname, ebr->edev.dep_name); ebr->edev.retry.cb = bridge_dependency_retry; uloop_timeout_set(&ebr->edev.retry, 200); diff --git a/interface-event.c b/interface-event.c index b03bfbc..892d744 100644 --- a/interface-event.c +++ b/interface-event.c @@ -97,7 +97,7 @@ call_hotplug(void) if ((current_ev == IFEV_UP || current_ev == IFEV_UPDATE) && current->l3_dev.dev) device = current->l3_dev.dev->ifname; - D(SYSTEM, "Call hotplug handler for interface '%s', event '%s' (%s)\n", + D(SYSTEM, "Call hotplug handler for interface '%s', event '%s' (%s)", current->name, eventnames[current_ev], device ? device : "none"); run_cmd(current->name, device, current_ev, current->updated); } @@ -106,7 +106,7 @@ static void task_complete(struct uloop_process *proc, int ret) { if (current) - D(SYSTEM, "Complete hotplug handler for interface '%s'\n", current->name); + D(SYSTEM, "Complete hotplug handler for interface '%s'", current->name); current = NULL; call_hotplug(); } @@ -121,7 +121,7 @@ task_complete(struct uloop_process *proc, int ret) static void interface_queue_event(struct interface *iface, enum interface_event ev) { - D(SYSTEM, "Queue hotplug handler for interface '%s', event '%s'\n", + D(SYSTEM, "Queue hotplug handler for interface '%s', event '%s'", iface->name, eventnames[ev]); if (ev == IFEV_UP || ev == IFEV_DOWN) netifd_ubus_interface_event(iface, ev == IFEV_UP); diff --git a/interface-ip.c b/interface-ip.c index 592b528..7e60f64 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)) { - D(INTERFACE, "Failed to parse route target: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse route target: %s", (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)) { - D(INTERFACE, "Failed to parse route gateway: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse route gateway: %s", (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) { - D(INTERFACE, "Failed to parse route source: %s\n", addr ? addr : "NULL"); + D(INTERFACE, "Failed to parse route source: %s", 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)) { - D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s", (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)) { - D(INTERFACE, "Failed to resolve routing type: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing type: %s", (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)) { - D(INTERFACE, "Failed to resolve proto type: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve proto type: %s", (char *) blobmsg_data(cur)); goto error; } route->flags |= DEVROUTE_PROTO; @@ -1432,7 +1432,7 @@ interface_add_dns_server(struct interface_ip_settings *ip, const char *str) return; add: - D(INTERFACE, "Add IPv%c DNS server: %s\n", + D(INTERFACE, "Add IPv%c DNS server: %s", s->af == AF_INET6 ? '6' : '4', str); vlist_simple_add(&ip->dns_servers, &s->node); } @@ -1464,7 +1464,7 @@ interface_add_dns_search_domain(struct interface_ip_settings *ip, const char *st if (!s) return; - D(INTERFACE, "Add DNS search domain: %s\n", str); + D(INTERFACE, "Add DNS search domain: %s", str); memcpy(s->name, str, len); vlist_simple_add(&ip->dns_search, &s->node); } @@ -1600,7 +1600,7 @@ interface_write_resolv_conf(const char *jail) unlink(tmppath); f = fopen(tmppath, "w+"); if (!f) { - D(INTERFACE, "Failed to open %s for writing\n", path); + D(INTERFACE, "Failed to open %s for writing", path); return; } @@ -1621,7 +1621,7 @@ interface_write_resolv_conf(const char *jail) if (crcold == crcnew) { unlink(tmppath); } else if (rename(tmppath, path) < 0) { - D(INTERFACE, "Failed to replace %s\n", path); + D(INTERFACE, "Failed to replace %s", path); unlink(tmppath); } } diff --git a/interface.c b/interface.c index 2237b78..4352559 100644 --- a/interface.c +++ b/interface.c @@ -484,7 +484,7 @@ interface_set_available(struct interface *iface, bool new_state) if (iface->available == new_state) return; - D(INTERFACE, "Interface '%s', available=%d\n", iface->name, new_state); + D(INTERFACE, "Interface '%s', available=%d", iface->name, new_state); iface->available = new_state; if (new_state) { @@ -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)) - D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s", (char *) blobmsg_data(cur)); } if ((cur = tb[IFACE_ATTR_IP6TABLE])) { if (!system_resolve_rt_table(blobmsg_data(cur), &iface->ip6table)) - D(INTERFACE, "Failed to resolve routing table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to resolve routing table: %s", (char *) blobmsg_data(cur)); } iface->proto_ip.no_delegation = !blobmsg_get_bool_default(tb[IFACE_ATTR_DELEGATE], true); @@ -1297,7 +1297,7 @@ interface_change_config(struct interface *if_old, struct interface *if_new) reload = true; if (!if_old->proto_handler->config_params) - D(INTERFACE, "No config parameters for interface '%s'\n", + D(INTERFACE, "No config parameters for interface '%s'", if_old->name); else if (!uci_blob_check_equal(if_old->config, if_new->config, if_old->proto_handler->config_params)) @@ -1360,7 +1360,7 @@ interface_change_config(struct interface *if_old, struct interface *if_new) #undef UPDATE if (reload) { - D(INTERFACE, "Reload interface '%s' because of config changes\n", + D(INTERFACE, "Reload interface '%s' because of config changes", if_old->name); interface_clear_errors(if_old); set_config_state(if_old, IFC_RELOAD); @@ -1399,13 +1399,13 @@ interface_update(struct vlist_tree *tree, struct vlist_node *node_new, struct interface *if_new = container_of(node_new, struct interface, node); if (node_old && node_new) { - D(INTERFACE, "Update interface '%s'\n", if_new->name); + D(INTERFACE, "Update interface '%s'", if_new->name); interface_change_config(if_old, if_new); } else if (node_old) { - D(INTERFACE, "Remove interface '%s'\n", if_old->name); + D(INTERFACE, "Remove interface '%s'", if_old->name); set_config_state(if_old, IFC_REMOVE); } else if (node_new) { - D(INTERFACE, "Create interface '%s'\n", if_new->name); + D(INTERFACE, "Create interface '%s'", if_new->name); interface_event(if_new, IFEV_CREATE); proto_init_interface(if_new, if_new->config); interface_claim_device(if_new); diff --git a/iprule.c b/iprule.c index 19284b7..e851e2d 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)) { - D(INTERFACE, "Failed to parse rule source: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule source: %s", (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)) { - D(INTERFACE, "Failed to parse rule destination: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule destination: %s", (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) { - D(INTERFACE, "Invalid TOS value: %u\n", blobmsg_get_u32(cur)); + D(INTERFACE, "Invalid TOS value: %u", 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)) { - D(INTERFACE, "Failed to parse rule fwmark: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule fwmark: %s", (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)) { - D(INTERFACE, "Failed to parse rule lookup table: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule lookup table: %s", (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) { - D(INTERFACE, "Failed to parse UID range: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse UID range: %s", (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)) { - D(INTERFACE, "Failed to parse rule action: %s\n", (char *) blobmsg_data(cur)); + D(INTERFACE, "Failed to parse rule action: %s", (char *) blobmsg_data(cur)); goto error; } rule->flags |= IPRULE_ACTION; diff --git a/macvlan.c b/macvlan.c index c4ebdd0..cdc924f 100644 --- a/macvlan.c +++ b/macvlan.c @@ -113,7 +113,7 @@ macvlan_set_state(struct device *dev, bool up) { struct macvlan_device *mvdev; - D(SYSTEM, "macvlan_set_state(%s, %u)\n", dev->ifname, up); + D(SYSTEM, "macvlan_set_state(%s, %u)", dev->ifname, up); mvdev = container_of(dev, struct macvlan_device, dev); if (up) diff --git a/netifd.h b/netifd.h index df9d324..a462abd 100644 --- a/netifd.h +++ b/netifd.h @@ -73,8 +73,10 @@ enum { #define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__) #define D(level, format, ...) do { \ netifd_udebug_printf("[" #level "] %s(%d): " format, __func__, __LINE__, ## __VA_ARGS__); \ - if (debug_mask & (1 << (DEBUG_ ## level))) \ - DPRINTF(format, ##__VA_ARGS__); \ + if (debug_mask & (1 << (DEBUG_ ## level))) { \ + DPRINTF(format, ##__VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } \ } while (0) #else #define DPRINTF(format, ...) no_debug(0, format, ## __VA_ARGS__) diff --git a/proto-shell.c b/proto-shell.c index 2139806..5316531 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -228,7 +228,7 @@ proto_shell_handler(struct interface_proto_state *proto, } } - D(INTERFACE, "run %s for interface '%s'\n", action, proto->iface->name); + D(INTERFACE, "run %s for interface '%s'", action, proto->iface->name); config = blobmsg_format_json(state->config, true); if (!config) return -1; @@ -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) { - D(INTERFACE, "Ignore wrong route type: %d\n", blobmsg_type(cur)); + D(INTERFACE, "Ignore wrong route type: %d", 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) { - D(INTERFACE, "Ignore wrong neighbor type: %d\n", blobmsg_type(cur)); + D(INTERFACE, "Ignore wrong neighbor type: %d", blobmsg_type(cur)); continue; } @@ -825,7 +825,7 @@ proto_shell_checkup_timeout_cb(struct uloop_timeout *timeout) if (iface->state == IFS_UP) return; - D(INTERFACE, "Interface '%s' is not up after %d sec\n", + D(INTERFACE, "Interface '%s' is not up after %d sec", iface->name, state->checkup_interval); proto_shell_handler(proto, PROTO_CMD_TEARDOWN, false); } @@ -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); - D(INTERFACE, "Add handler for script %s: %s\n", script, proto->name); + D(INTERFACE, "Add handler for script %s: %s", script, proto->name); add_proto_handler(proto); } diff --git a/system-dummy.c b/system-dummy.c index 84382b3..f4eac87 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -32,32 +32,32 @@ int system_init(void) int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg) { - D(SYSTEM, "brctl addbr %s vlan_filtering=%d\n", + D(SYSTEM, "brctl addbr %s vlan_filtering=%d", bridge->ifname, cfg->vlan_filtering); return 0; } int system_bridge_delbr(struct device *bridge) { - D(SYSTEM, "brctl delbr %s\n", bridge->ifname); + D(SYSTEM, "brctl delbr %s", bridge->ifname); return 0; } int system_bridge_addif(struct device *bridge, struct device *dev) { - D(SYSTEM, "brctl addif %s %s\n", bridge->ifname, dev->ifname); + D(SYSTEM, "brctl addif %s %s", bridge->ifname, dev->ifname); return 0; } int system_bridge_delif(struct device *bridge, struct device *dev) { - D(SYSTEM, "brctl delif %s %s\n", bridge->ifname, dev->ifname); + D(SYSTEM, "brctl delif %s %s", bridge->ifname, dev->ifname); return 0; } int system_bridge_vlan(const char *iface, uint16_t vid, int16_t vid_end, bool add, unsigned int vflags) { - D(SYSTEM, "brctl vlan %s %s %s vid=%d vid_end=%d pvid=%d untag=%d\n", + D(SYSTEM, "brctl vlan %s %s %s vid=%d vid_end=%d pvid=%d untag=%d", add ? "add" : "remove", (vflags & BRVLAN_F_SELF) ? "self" : "master", iface, vid, vid_end, @@ -87,31 +87,31 @@ int system_bonding_set_port(struct device *dev, struct device *port, bool add, b int system_link_netns_move(struct device *dev, int netns_fd, const char *target_ifname) { - D(SYSTEM, "ip link set %s name %s netns %d\n", dev->ifname, target_ifname, netns_fd); + D(SYSTEM, "ip link set %s name %s netns %d", dev->ifname, target_ifname, netns_fd); return 0; } int system_netns_open(const pid_t target_ns) { - D(SYSTEM, "open netns of pid %d\n", target_ns); + D(SYSTEM, "open netns of pid %d", target_ns); return 1; } int system_netns_set(int netns_fd) { - D(SYSTEM, "set netns %d\n", netns_fd); + D(SYSTEM, "set netns %d", netns_fd); return 0; } int system_vlan_add(struct device *dev, int id) { - D(SYSTEM, "vconfig add %s %d\n", dev->ifname, id); + D(SYSTEM, "vconfig add %s %d", dev->ifname, id); return 0; } int system_vlan_del(struct device *dev) { - D(SYSTEM, "vconfig rem %s\n", dev->ifname); + D(SYSTEM, "vconfig rem %s", dev->ifname); return 0; } @@ -122,13 +122,13 @@ bool system_if_force_external(const char *ifname) int system_if_up(struct device *dev) { - D(SYSTEM, "ifconfig %s up\n", dev->ifname); + D(SYSTEM, "ifconfig %s up", dev->ifname); return 0; } int system_if_down(struct device *dev) { - D(SYSTEM, "ifconfig %s down\n", dev->ifname); + D(SYSTEM, "ifconfig %s down", dev->ifname); return 0; } @@ -181,7 +181,7 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, uint64_t apply_mask &= s->flags; if ((apply_mask & (DEV_OPT_MACADDR | DEV_OPT_DEFAULT_MACADDR)) && !dev->external) { - D(SYSTEM, "ifconfig %s hw ether %s\n", + D(SYSTEM, "ifconfig %s hw ether %s", dev->ifname, format_macaddr(s->macaddr)); } } @@ -191,7 +191,7 @@ static int system_address_msg(struct device *dev, struct device_addr *addr, cons char ipaddr[64]; int af = system_get_addr_family(addr->flags); - D(SYSTEM, "ifconfig %s %s %s/%u\n", + D(SYSTEM, "ifconfig %s %s %s/%u", dev->ifname, type, inet_ntop(af, &addr->addr.in, ipaddr, sizeof(ipaddr)), addr->mask); @@ -234,7 +234,7 @@ static int system_route_msg(struct device *dev, struct device_route *route, cons if (route->metric > 0) sprintf(devstr, " metric %d", route->metric); - D(SYSTEM, "route %s %s%s%s\n", type, addr, gw, devstr); + D(SYSTEM, "route %s %s%s%s", type, addr, gw, devstr); return 0; } @@ -244,7 +244,7 @@ static int system_neighbor_msg(struct device *dev, struct device_neighbor *neigh int af = system_get_addr_family(neighbor->flags); inet_ntop(af, &neighbor->addr.in , addr, sizeof(addr)); - D(SYSTEM, "neigh %s %s%s%s %s\n", type, addr, neighbor->proxy ? "proxy " : "", + D(SYSTEM, "neigh %s %s%s%s %s", type, addr, neighbor->proxy ? "proxy " : "", (neighbor->flags & DEVNEIGH_MAC) ? format_macaddr(neighbor->macaddr) : "", neighbor->router ? "router": ""); return 0; diff --git a/system-linux.c b/system-linux.c index 4d25279..b7b1157 100644 --- a/system-linux.c +++ b/system-linux.c @@ -970,7 +970,7 @@ int system_bridge_addif(struct device *bridge, struct device *dev) if (!ret) break; - D(SYSTEM, "Failed to add device '%s' to bridge '%s' (tries=%d): %s\n", + D(SYSTEM, "Failed to add device '%s' to bridge '%s' (tries=%d): %s", dev->ifname, bridge->ifname, tries, strerror(errno)); } @@ -1250,9 +1250,9 @@ static int cb_clear_event(struct nl_msg *msg, void *arg) return NL_SKIP; if (type == RTM_DELRULE) - D(SYSTEM, "Remove a rule\n"); + D(SYSTEM, "Remove a rule"); else - D(SYSTEM, "Remove %s from device %s\n", + D(SYSTEM, "Remove %s from device %s", type == RTM_DELADDR ? "an address" : "a route", clr->dev->ifname); @@ -1265,9 +1265,9 @@ static int cb_clear_event(struct nl_msg *msg, void *arg) ret = nl_send_auto_complete(sock_rtnl, clr->msg); if (ret < 0) { if (type == RTM_DELRULE) - D(SYSTEM, "Error deleting a rule: %d\n", ret); + D(SYSTEM, "Error deleting a rule: %d", ret); else - D(SYSTEM, "Error deleting %s from device '%s': %d\n", + D(SYSTEM, "Error deleting %s from device '%s': %d", type == RTM_DELADDR ? "an address" : "a route", clr->dev->ifname, ret); } @@ -1360,14 +1360,14 @@ void system_if_clear_state(struct device *dev) system_if_flags(dev->ifname, 0, IFF_UP); if (system_is_bridge(dev->ifname)) { - D(SYSTEM, "Delete existing bridge named '%s'\n", dev->ifname); + D(SYSTEM, "Delete existing bridge named '%s'", dev->ifname); system_bridge_delbr(dev); return; } bridge = system_get_bridge(dev->ifname, buf, sizeof(buf)); if (bridge) { - D(SYSTEM, "Remove device '%s' from bridge '%s'\n", dev->ifname, bridge); + D(SYSTEM, "Remove device '%s' from bridge '%s'", dev->ifname, bridge); system_bridge_if(bridge, dev, SIOCBRDELIF, NULL); } @@ -1460,7 +1460,7 @@ int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg) rv = system_rtnl_call(msg); if (rv) - D(SYSTEM, "Error adding bridge '%s': %d\n", bridge->ifname, rv); + D(SYSTEM, "Error adding bridge '%s': %d", bridge->ifname, rv); return rv; @@ -1516,7 +1516,7 @@ int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvla rv = system_rtnl_call(msg); if (rv) - D(SYSTEM, "Error adding macvlan '%s' over '%s': %d\n", macvlan->ifname, dev->ifname, rv); + D(SYSTEM, "Error adding macvlan '%s' over '%s': %d", macvlan->ifname, dev->ifname, rv); return rv; @@ -1604,9 +1604,9 @@ int system_veth_add(struct device *veth, struct veth_config *cfg) rv = system_rtnl_call(msg); if (rv) { if (cfg->flags & VETH_OPT_PEER_NAME) - D(SYSTEM, "Error adding veth '%s' with peer '%s': %d\n", veth->ifname, cfg->peer_name, rv); + D(SYSTEM, "Error adding veth '%s' with peer '%s': %d", veth->ifname, cfg->peer_name, rv); else - D(SYSTEM, "Error adding veth '%s': %d\n", veth->ifname, rv); + D(SYSTEM, "Error adding veth '%s': %d", veth->ifname, rv); } return rv; @@ -1712,7 +1712,7 @@ int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlande rv = system_rtnl_call(msg); if (rv) - D(SYSTEM, "Error adding vlandev '%s' over '%s': %d\n", vlandev->ifname, dev->ifname, rv); + D(SYSTEM, "Error adding vlandev '%s' over '%s': %d", vlandev->ifname, dev->ifname, rv); return rv; @@ -4409,7 +4409,7 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl ret = system_rtnl_call(msg); if (ret) - D(SYSTEM, "Error adding vxlan '%s': %d\n", name, ret); + D(SYSTEM, "Error adding vxlan '%s': %d", name, ret); return ret; diff --git a/ubus.c b/ubus.c index 609cec8..3d24dc7 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) { - D(SYSTEM, "failed to reconnect, trying again in %d seconds\n", t); + D(SYSTEM, "failed to reconnect, trying again in %d seconds", t); uloop_timeout_set(&retry, t * 1000); return; } - D(SYSTEM, "reconnected to ubus, new id: %08x\n", ubus_ctx->local_id); + D(SYSTEM, "reconnected to ubus, new id: %08x", ubus_ctx->local_id); netifd_ubus_add_fd(); } @@ -1375,7 +1375,7 @@ netifd_ubus_init(const char *path) if (!ubus_ctx) return -EIO; - D(SYSTEM, "connected as %08x\n", ubus_ctx->local_id); + D(SYSTEM, "connected as %08x", ubus_ctx->local_id); ubus_ctx->connection_lost = netifd_ubus_connection_lost; netifd_ubus_add_fd(); @@ -1430,7 +1430,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)) { - D(SYSTEM, "failed to publish ubus object for interface '%s'\n", iface->name); + D(SYSTEM, "failed to publish ubus object for interface '%s'", iface->name); free(name); obj->name = NULL; } diff --git a/veth.c b/veth.c index fdab38a..8d37dd3 100644 --- a/veth.c +++ b/veth.c @@ -88,7 +88,7 @@ veth_set_state(struct device *dev, bool up) { struct veth *veth; - D(SYSTEM, "veth_set_state(%s, %u)\n", dev->ifname, up); + D(SYSTEM, "veth_set_state(%s, %u)", dev->ifname, up); veth = container_of(dev, struct veth, dev); if (up) diff --git a/vlan.c b/vlan.c index 4e84344..52d855a 100644 --- a/vlan.c +++ b/vlan.c @@ -208,7 +208,7 @@ static struct device *get_vlan_device(struct device *dev, char *id_str, bool cre if (snprintf(name, sizeof(name), "%s.%d", dev->ifname, id) >= (int)sizeof(name) - 1) return NULL; - D(DEVICE, "Create vlan device '%s'\n", name); + D(DEVICE, "Create vlan device '%s'", name); vldev = calloc(1, sizeof(*vldev)); if (!vldev) diff --git a/vlandev.c b/vlandev.c index 43efc17..4d6e76a 100644 --- a/vlandev.c +++ b/vlandev.c @@ -191,7 +191,7 @@ vlandev_set_state(struct device *dev, bool up) { struct vlandev_device *mvdev; - D(SYSTEM, "vlandev_set_state(%s, %u)\n", dev->ifname, up); + D(SYSTEM, "vlandev_set_state(%s, %u)", dev->ifname, up); mvdev = container_of(dev, struct vlandev_device, dev); if (up) diff --git a/wireless.c b/wireless.c index 654c87e..55be29b 100644 --- a/wireless.c +++ b/wireless.c @@ -257,7 +257,7 @@ wireless_complete_kill_request(struct wireless_device *wdev) static void wireless_process_free(struct wireless_device *wdev, struct wireless_process *proc) { - D(WIRELESS, "Wireless device '%s' free pid %d\n", wdev->name, proc->pid); + D(WIRELESS, "Wireless device '%s' free pid %d", wdev->name, proc->pid); list_del(&proc->list); free(proc); @@ -285,7 +285,7 @@ wireless_process_kill_all(struct wireless_device *wdev, int signal, bool free) bool check = wireless_process_check(proc); if (check && !proc->keep) { - D(WIRELESS, "Wireless device '%s' kill pid %d\n", wdev->name, proc->pid); + D(WIRELESS, "Wireless device '%s' kill pid %d", wdev->name, proc->pid); kill(proc->pid, signal); } @@ -424,7 +424,7 @@ wireless_device_setup_cancel(struct wireless_device *wdev) return; wireless_handler_stop(wdev); - D(WIRELESS, "Cancel wireless device '%s' setup\n", wdev->name); + D(WIRELESS, "Cancel wireless device '%s' setup", wdev->name); wdev->cancel = true; uloop_timeout_set(&wdev->timeout, 10 * 1000); } @@ -449,7 +449,7 @@ wireless_device_run_handler(struct wireless_device *wdev, bool up) if (wdev->serialize) handler_pending = true; - D(WIRELESS, "Wireless device '%s' run %s handler\n", wdev->name, action); + D(WIRELESS, "Wireless device '%s' run %s handler", wdev->name, action); if (!up && wdev->prev_config) { config = blobmsg_format_json(wdev->prev_config, true); free(wdev->prev_config); @@ -728,7 +728,7 @@ wdev_change_config(struct wireless_device *wdev, struct wireless_device *wd_new) if (blob_attr_equal(wdev->config, new_config) && wdev->disabled == disabled) return; - D(WIRELESS, "Update configuration of wireless device '%s'\n", wdev->name); + D(WIRELESS, "Update configuration of wireless device '%s'", wdev->name); free(wdev->config); wdev->config = blob_memdup(new_config); wdev->disabled = disabled; @@ -751,13 +751,13 @@ wdev_update(struct vlist_tree *tree, struct vlist_node *node_new, struct wireless_device *wd_new = container_of(node_new, struct wireless_device, node); if (wd_old && wd_new) { - D(WIRELESS, "Update wireless device '%s'\n", wd_old->name); + D(WIRELESS, "Update wireless device '%s'", wd_old->name); wdev_change_config(wd_old, wd_new); } else if (wd_old) { - D(WIRELESS, "Delete wireless device '%s'\n", wd_old->name); + D(WIRELESS, "Delete wireless device '%s'", wd_old->name); wdev_set_config_state(wd_old, IFC_REMOVE); } else if (wd_new) { - D(WIRELESS, "Create wireless device '%s'\n", wd_new->name); + D(WIRELESS, "Create wireless device '%s'", wd_new->name); wdev_create(wd_new); } } @@ -813,7 +813,7 @@ wireless_add_handler(const char *script, const char *name, json_object *obj) drv->node.key = drv->name; avl_insert(&wireless_drivers, &drv->node); - D(WIRELESS, "Add handler for script %s: %s\n", script, name); + D(WIRELESS, "Add handler for script %s: %s", script, name); } void wireless_init(void) @@ -894,19 +894,19 @@ vif_update(struct vlist_tree *tree, struct vlist_node *node_new, return; } - D(WIRELESS, "Update wireless interface %s on device %s\n", vif_new->name, wdev->name); + D(WIRELESS, "Update wireless interface %s on device %s", vif_new->name, wdev->name); wireless_interface_handle_link(vif_old, NULL, false); free(vif_old->config); vif_old->config = blob_memdup(vif_new->config); wireless_interface_init_config(vif_old); free(vif_new); } else if (vif_new) { - D(WIRELESS, "Create new wireless interface %s on device %s\n", vif_new->name, wdev->name); + D(WIRELESS, "Create new wireless interface %s on device %s", vif_new->name, wdev->name); vif_new->section = strdup(vif_new->section); vif_new->config = blob_memdup(vif_new->config); wireless_interface_init_config(vif_new); } else if (vif_old) { - D(WIRELESS, "Delete wireless interface %s on device %s\n", vif_old->name, wdev->name); + D(WIRELESS, "Delete wireless interface %s on device %s", vif_old->name, wdev->name); wireless_interface_handle_link(vif_old, NULL, false); vif_free(vif_old); } @@ -958,7 +958,7 @@ vlan_update(struct vlist_tree *tree, struct vlist_node *node_new, return; } - D(WIRELESS, "Update wireless vlan %s on device %s\n", vlan_new->name, wdev->name); + D(WIRELESS, "Update wireless vlan %s on device %s", vlan_new->name, wdev->name); wireless_vlan_handle_link(vlan_old, false); free(vlan_old->config); vlan_old->config = blob_memdup(vlan_new->config); @@ -966,12 +966,12 @@ vlan_update(struct vlist_tree *tree, struct vlist_node *node_new, wireless_vlan_init_config(vlan_old); free(vlan_new); } else if (vlan_new) { - D(WIRELESS, "Create new wireless vlan %s on device %s\n", vlan_new->name, wdev->name); + D(WIRELESS, "Create new wireless vlan %s on device %s", vlan_new->name, wdev->name); vlan_new->section = strdup(vlan_new->section); vlan_new->config = blob_memdup(vlan_new->config); wireless_vlan_init_config(vlan_new); } else if (vlan_old) { - D(WIRELESS, "Delete wireless vlan %s on device %s\n", vlan_old->name, wdev->name); + D(WIRELESS, "Delete wireless vlan %s on device %s", vlan_old->name, wdev->name); wireless_vlan_handle_link(vlan_old, false); free((void *) vlan_old->section); free(vlan_old->config); @@ -999,16 +999,16 @@ station_update(struct vlist_tree *tree, struct vlist_node *node_new, return; } - D(WIRELESS, "Update wireless station %s on device %s\n", sta_new->name, wdev->name); + D(WIRELESS, "Update wireless station %s on device %s", sta_new->name, wdev->name); free(sta_old->config); sta_old->config = blob_memdup(sta_new->config); free(sta_new); } else if (sta_new) { - D(WIRELESS, "Create new wireless station %s on device %s\n", sta_new->name, wdev->name); + D(WIRELESS, "Create new wireless station %s on device %s", sta_new->name, wdev->name); sta_new->section = strdup(sta_new->section); sta_new->config = blob_memdup(sta_new->config); } else if (sta_old) { - D(WIRELESS, "Delete wireless station %s on device %s\n", sta_old->name, wdev->name); + D(WIRELESS, "Delete wireless station %s on device %s", sta_old->name, wdev->name); free((void *) sta_old->section); free(sta_old->config); free(sta_old); @@ -1057,7 +1057,7 @@ wireless_device_check_script_tasks(struct uloop_timeout *timeout) if (wireless_process_check(proc)) continue; - D(WIRELESS, "Wireless device '%s' pid %d has terminated\n", wdev->name, proc->pid); + D(WIRELESS, "Wireless device '%s' pid %d has terminated", wdev->name, proc->pid); if (proc->required) restart = true; @@ -1394,7 +1394,7 @@ wireless_device_add_process(struct wireless_device *wdev, struct blob_attr *data if (tb[PROC_ATTR_KEEP]) proc->keep = blobmsg_get_bool(tb[PROC_ATTR_KEEP]); - D(WIRELESS, "Wireless device '%s' add pid %d\n", wdev->name, proc->pid); + D(WIRELESS, "Wireless device '%s' add pid %d", wdev->name, proc->pid); list_add(&proc->list, &wdev->script_proc); uloop_timeout_set(&wdev->script_check, 0);