typedef struct Link Link;
-typedef struct NetworkConfigSection {
- unsigned line;
- bool invalid;
- char filename[];
-} NetworkConfigSection;
-
typedef enum NetworkConfigSource {
NETWORK_CONFIG_SOURCE_FOREIGN, /* configured by kernel */
NETWORK_CONFIG_SOURCE_STATIC,
NETWORK_CONFIG_SOURCE_IPV4LL,
NETWORK_CONFIG_SOURCE_DHCP4,
NETWORK_CONFIG_SOURCE_DHCP6,
- NETWORK_CONFIG_SOURCE_DHCP6PD,
+ NETWORK_CONFIG_SOURCE_DHCP_PD,
NETWORK_CONFIG_SOURCE_NDISC,
+ NETWORK_CONFIG_SOURCE_RUNTIME, /* through D-Bus method */
_NETWORK_CONFIG_SOURCE_MAX,
_NETWORK_CONFIG_SOURCE_INVALID = -EINVAL,
} NetworkConfigSource;
typedef enum NetworkConfigState {
- NETWORK_CONFIG_STATE_PROBING = 1 << 0, /* address is probing by IPv4ACD */
- NETWORK_CONFIG_STATE_REQUESTING = 1 << 1, /* request is queued */
- NETWORK_CONFIG_STATE_CONFIGURING = 1 << 2, /* e.g. address_configure() is called, but no responce is received yet */
- NETWORK_CONFIG_STATE_CONFIGURED = 1 << 3, /* e.g. address_configure() is called and received a response from kernel.
+ NETWORK_CONFIG_STATE_REQUESTING = 1 << 0, /* request is queued */
+ NETWORK_CONFIG_STATE_CONFIGURING = 1 << 1, /* e.g. address_configure() is called, but no response is received yet */
+ NETWORK_CONFIG_STATE_CONFIGURED = 1 << 2, /* e.g. address_configure() is called and received a response from kernel.
* Note that address may not be ready yet, so please use address_is_ready()
* to check whether the address can be usable or not. */
- NETWORK_CONFIG_STATE_MARKED = 1 << 4, /* used GC'ing the old config */
- NETWORK_CONFIG_STATE_REMOVING = 1 << 5, /* e.g. address_remove() is called, but no responce is received yet */
+ NETWORK_CONFIG_STATE_MARKED = 1 << 3, /* used GC'ing the old config */
+ NETWORK_CONFIG_STATE_REMOVING = 1 << 4, /* e.g. address_remove() is called, but no response is received yet */
} NetworkConfigState;
+static inline usec_t sec16_to_usec(uint16_t sec, usec_t timestamp_usec) {
+ return sec == UINT16_MAX ? USEC_INFINITY : usec_add(timestamp_usec, sec * USEC_PER_SEC);
+}
+
+static inline usec_t sec_to_usec(uint32_t sec, usec_t timestamp_usec) {
+ return sec == UINT32_MAX ? USEC_INFINITY : usec_add(timestamp_usec, sec * USEC_PER_SEC);
+}
+
+static inline uint32_t usec_to_sec(usec_t usec, usec_t now_usec) {
+ return MIN(DIV_ROUND_UP(usec_sub_unsigned(usec, now_usec), USEC_PER_SEC), UINT32_MAX);
+}
+
CONFIG_PARSER_PROTOTYPE(config_parse_link_local_address_family);
CONFIG_PARSER_PROTOTYPE(config_parse_address_family_with_kernel);
CONFIG_PARSER_PROTOTYPE(config_parse_ip_masquerade);
const char *dhcp_lease_server_type_to_string(sd_dhcp_lease_server_type_t t) _const_;
sd_dhcp_lease_server_type_t dhcp_lease_server_type_from_string(const char *s) _pure_;
-int kernel_route_expiration_supported(void);
-
-static inline NetworkConfigSection* network_config_section_free(NetworkConfigSection *cs) {
- return mfree(cs);
-}
-DEFINE_TRIVIAL_CLEANUP_FUNC(NetworkConfigSection*, network_config_section_free);
-
-int network_config_section_new(const char *filename, unsigned line, NetworkConfigSection **s);
-extern const struct hash_ops network_config_hash_ops;
-unsigned hashmap_find_free_section_line(Hashmap *hashmap);
-
-static inline bool section_is_invalid(NetworkConfigSection *section) {
- /* If this returns false, then it does _not_ mean the section is valid. */
-
- if (!section)
- return false;
-
- return section->invalid;
-}
-
-#define DEFINE_NETWORK_SECTION_FUNCTIONS(type, free_func) \
- static inline type* free_func##_or_set_invalid(type *p) { \
- assert(p); \
- \
- if (p->section) \
- p->section->invalid = true; \
- else \
- free_func(p); \
- return NULL; \
- } \
- DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func); \
- DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func##_or_set_invalid);
-
int log_link_message_full_errno(Link *link, sd_netlink_message *m, int level, int err, const char *msg);
#define log_link_message_error_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_ERR, err, msg)
#define log_link_message_warning_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_WARNING, err, msg)