]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp: fix namespacing
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 22 Sep 2015 12:46:21 +0000 (14:46 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 22 Sep 2015 12:46:21 +0000 (14:46 +0200)
Prefix all constants with SD_DHCP_CLIENT_* to avoid namespacing
conflicts.

src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/test-dhcp-client.c
src/network/networkd-dhcp4.c
src/systemd/sd-dhcp-client.h

index c12768cf0e5b002a66eb48162515f81b292ca735..141b836a0d78f3b3acc45e7a32b798de276d7f94 100644 (file)
@@ -213,7 +213,7 @@ int sd_dhcp_client_set_mac(sd_dhcp_client *client, const uint8_t *addr,
                 log_dhcp_client(client, "Changing MAC address on running DHCP "
                                 "client, restarting");
                 need_restart = true;
-                client_stop(client, DHCP_EVENT_STOP);
+                client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
         }
 
         memcpy(&client->mac_addr, addr, addr_len);
@@ -277,7 +277,7 @@ int sd_dhcp_client_set_client_id(sd_dhcp_client *client, uint8_t type,
                 log_dhcp_client(client, "Changing client ID on running DHCP "
                                 "client, restarting");
                 need_restart = true;
-                client_stop(client, DHCP_EVENT_STOP);
+                client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
         }
 
         client->client_id.type = type;
@@ -385,7 +385,7 @@ static void client_stop(sd_dhcp_client *client, int error) {
 
         if (error < 0)
                 log_dhcp_client(client, "STOPPED: %s", strerror(-error));
-        else if (error == DHCP_EVENT_STOP)
+        else if (error == SD_DHCP_CLIENT_EVENT_STOP)
                 log_dhcp_client(client, "STOPPED");
         else
                 log_dhcp_client(client, "STOPPED: Unknown event");
@@ -983,7 +983,7 @@ static int client_timeout_expire(sd_event_source *s, uint64_t usec,
 
         log_dhcp_client(client, "EXPIRED");
 
-        client_notify(client, DHCP_EVENT_EXPIRED);
+        client_notify(client, SD_DHCP_CLIENT_EVENT_EXPIRED);
 
         /* lease was lost, start over if not freed or stopped in callback */
         if (client->state != DHCP_STATE_STOPPED) {
@@ -1143,14 +1143,14 @@ static int client_handle_ack(sd_dhcp_client *client, DHCPMessage *ack,
                 }
         }
 
-        r = DHCP_EVENT_IP_ACQUIRE;
+        r = SD_DHCP_CLIENT_EVENT_IP_ACQUIRE;
         if (client->lease) {
                 if (client->lease->address != lease->address ||
                     client->lease->subnet_mask != lease->subnet_mask ||
                     client->lease->router != lease->router) {
-                        r = DHCP_EVENT_IP_CHANGE;
+                        r = SD_DHCP_CLIENT_EVENT_IP_CHANGE;
                 } else
-                        r = DHCP_EVENT_RENEW;
+                        r = SD_DHCP_CLIENT_EVENT_RENEW;
 
                 client->lease = sd_dhcp_lease_unref(client->lease);
         }
@@ -1382,8 +1382,8 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
 
                         if (IN_SET(client->state, DHCP_STATE_REQUESTING,
                                    DHCP_STATE_REBOOTING))
-                                notify_event = DHCP_EVENT_IP_ACQUIRE;
-                        else if (r != DHCP_EVENT_IP_ACQUIRE)
+                                notify_event = SD_DHCP_CLIENT_EVENT_IP_ACQUIRE;
+                        else if (r != SD_DHCP_CLIENT_EVENT_IP_ACQUIRE)
                                 notify_event = r;
 
                         client->state = DHCP_STATE_BOUND;
@@ -1633,7 +1633,7 @@ int sd_dhcp_client_stop(sd_dhcp_client *client) {
 
         assert_return(client, -EINVAL);
 
-        client_stop(client, DHCP_EVENT_STOP);
+        client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
         client->state = DHCP_STATE_STOPPED;
 
         return 0;
index 29c20b77e38111550b3c183478b4c006557c4d9d..c112ec813467697a55a6775dff5d0af83e7a52dd 100644 (file)
@@ -360,7 +360,7 @@ static void test_addr_acq_acquired(sd_dhcp_client *client, int event,
         struct in_addr addr;
 
         assert_se(client);
-        assert_se(event == DHCP_EVENT_IP_ACQUIRE);
+        assert_se(event == SD_DHCP_CLIENT_EVENT_IP_ACQUIRE);
 
         assert_se(sd_dhcp_client_get_lease(client, &lease) >= 0);
         assert_se(lease);
index 4ffb01382f70b6f542c333389acc941eccc65a49..04f04df117698836b11d0b7fe807e17c6ae5ea79 100644 (file)
@@ -471,9 +471,9 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
                 return;
 
         switch (event) {
-                case DHCP_EVENT_EXPIRED:
-                case DHCP_EVENT_STOP:
-                case DHCP_EVENT_IP_CHANGE:
+                case SD_DHCP_CLIENT_EVENT_EXPIRED:
+                case SD_DHCP_CLIENT_EVENT_STOP:
+                case SD_DHCP_CLIENT_EVENT_IP_CHANGE:
                         if (link->network->dhcp_critical) {
                                 log_link_error(link, "DHCPv4 connection considered system critical, ignoring request to reconfigure it.");
                                 return;
@@ -487,7 +487,7 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
                                 }
                         }
 
-                        if (event == DHCP_EVENT_IP_CHANGE) {
+                        if (event == SD_DHCP_CLIENT_EVENT_IP_CHANGE) {
                                 r = dhcp_lease_acquired(client, link);
                                 if (r < 0) {
                                         link_enter_failed(link);
@@ -496,14 +496,14 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
                         }
 
                         break;
-                case DHCP_EVENT_RENEW:
+                case SD_DHCP_CLIENT_EVENT_RENEW:
                         r = dhcp_lease_renew(client, link);
                         if (r < 0) {
                                 link_enter_failed(link);
                                 return;
                         }
                         break;
-                case DHCP_EVENT_IP_ACQUIRE:
+                case SD_DHCP_CLIENT_EVENT_IP_ACQUIRE:
                         r = dhcp_lease_acquired(client, link);
                         if (r < 0) {
                                 link_enter_failed(link);
index 951662e56c00aa44302790a70d6577e7a3496033..4291fb7ebcb6b82ef1bc52ab0a12b15faf673b93 100644 (file)
 #include "sd-dhcp-lease.h"
 
 enum {
-        DHCP_EVENT_STOP                         = 0,
-        DHCP_EVENT_IP_ACQUIRE                   = 1,
-        DHCP_EVENT_IP_CHANGE                    = 2,
-        DHCP_EVENT_EXPIRED                      = 3,
-        DHCP_EVENT_RENEW                        = 4,
+        SD_DHCP_CLIENT_EVENT_STOP               = 0,
+        SD_DHCP_CLIENT_EVENT_IP_ACQUIRE         = 1,
+        SD_DHCP_CLIENT_EVENT_IP_CHANGE          = 2,
+        SD_DHCP_CLIENT_EVENT_EXPIRED            = 3,
+        SD_DHCP_CLIENT_EVENT_RENEW              = 4,
 };
 
 typedef struct sd_dhcp_client sd_dhcp_client;