From 2cb220d7fefe58844c4e34bbf6a164ff16e867e8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 3 Jan 2018 17:36:03 +0800 Subject: [PATCH] netif: Move LWIP_ASSERT_CORE_LOCKED out of static functions The netif_do_set_{ipaddr|netmask|gw} are static functions what won't be called directly, thus move LWIP_ASSERT_CORE_LOCKED to netif_set_{ipaddr|netmask|gw}. This avoid duplicated LWIP_ASSERT_CORE_LOCKED checking by netif_set_addr(). Signed-off-by: Axel Lin --- src/core/netif.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/netif.c b/src/core/netif.c index 6f9f99a6..375ee433 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -426,8 +426,6 @@ netif_do_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr, u8_t callback { ip_addr_t new_addr; - LWIP_ASSERT_CORE_LOCKED(); - *ip_2_ip4(&new_addr) = (ipaddr ? *ipaddr : *IP4_ADDR_ANY4); IP_SET_TYPE_VAL(new_addr, IPADDR_TYPE_V4); @@ -481,6 +479,8 @@ netif_do_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr, u8_t callback void netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr) { + LWIP_ASSERT_CORE_LOCKED(); + netif_do_set_ipaddr(netif, ipaddr, 1); } @@ -495,8 +495,6 @@ netif_do_set_netmask(struct netif *netif, const ip4_addr_t *netmask, u8_t callba args.ipv4_nm_changed.old_address = &old_addr; #endif - LWIP_ASSERT_CORE_LOCKED(); - /* address is actually being changed? */ if (ip4_addr_cmp(safe_netmask, netif_ip4_netmask(netif)) == 0) { mib2_remove_route_ip4(0, netif); @@ -530,6 +528,8 @@ netif_do_set_netmask(struct netif *netif, const ip4_addr_t *netmask, u8_t callba void netif_set_netmask(struct netif *netif, const ip4_addr_t *netmask) { + LWIP_ASSERT_CORE_LOCKED(); + netif_do_set_netmask(netif, netmask, 1); } @@ -544,8 +544,6 @@ netif_do_set_gw(struct netif *netif, const ip4_addr_t *gw, u8_t callback) args.ipv4_gw_changed.old_address = &old_addr; #endif - LWIP_ASSERT_CORE_LOCKED(); - /* address is actually being changed? */ if (ip4_addr_cmp(safe_gw, netif_ip4_gw(netif)) == 0) { ip4_addr_set(ip_2_ip4(&netif->gw), gw); @@ -575,6 +573,8 @@ netif_do_set_gw(struct netif *netif, const ip4_addr_t *gw, u8_t callback) void netif_set_gw(struct netif *netif, const ip4_addr_t *gw) { + LWIP_ASSERT_CORE_LOCKED(); + netif_do_set_gw(netif, gw, 1); }