sd-ipv4acd.c revision 2237aa02f3e2739a1ebe9c0bc224b5125f5eb292
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh This file is part of systemd.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh Copyright (C) 2014 Axis Communications AB. All rights reserved.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh Copyright (C) 2015 Tom Gundersen
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh systemd is free software; you can redistribute it and/or modify it
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh under the terms of the GNU Lesser General Public License as published by
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh the Free Software Foundation; either version 2.1 of the License, or
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh (at your option) any later version.
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers systemd is distributed in the hope that it will be useful, but
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh WITHOUT ANY WARRANTY; without even the implied warranty of
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh Lesser General Public License for more details.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh You should have received a copy of the GNU Lesser General Public License
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers along with systemd; If not, see <http://www.gnu.org/licenses/>.
718db96199eb307751264e4163555662c9a389faLennart Poettering/* Constants from the RFC */
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_full(ll, level, error, fmt, ...) log_internal(level, error, __FILE__, __LINE__, __func__, "ACD: " fmt, ##__VA_ARGS__)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_debug(ll, ...) log_ipv4acd_full(ll, LOG_DEBUG, 0, ##__VA_ARGS__)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_info(ll, ...) log_ipv4acd_full(ll, LOG_INFO, 0, ##__VA_ARGS__)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_notice(ll, ...) log_ipv4acd_full(ll, LOG_NOTICE, 0, ##__VA_ARGS__)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_warning(ll, ...) log_ipv4acd_full(ll, LOG_WARNING, 0, ##__VA_ARGS__)
718db96199eb307751264e4163555662c9a389faLennart Poettering#define log_ipv4acd_error(ll, ...) log_ipv4acd_full(ll, LOG_ERR, 0, ##__VA_ARGS__)
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#define log_ipv4acd_debug_errno(ll, error, ...) log_ipv4acd_full(ll, LOG_DEBUG, error, ##__VA_ARGS__)
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh#define log_ipv4acd_info_errno(ll, error, ...) log_ipv4acd_full(ll, LOG_INFO, error, ##__VA_ARGS__)
#define log_ipv4acd_notice_errno(ll, error, ...) log_ipv4acd_full(ll, LOG_NOTICE, error, ##__VA_ARGS__)
#define log_ipv4acd_warning_errno(ll, error, ...) log_ipv4acd_full(ll, LOG_WARNING, error, ##__VA_ARGS__)
typedef enum IPv4ACDState {
} IPv4ACDState;
struct sd_ipv4acd {
int index;
int fd;
int iteration;
int conflict;
int event_priority;
void* userdata;
if (ll)
return ll;
return NULL;
return NULL;
if (!ll)
return -ENOMEM;
if (random_sec)
case IPV4ACD_STATE_INIT:
goto out;
goto out;
case IPV4ACD_STATE_PROBING:
goto out;
goto out;
goto out;
case IPV4ACD_STATE_ANNOUNCING:
goto out;
goto out;
out:
if (r < (int) sizeof(struct ether_arp))
goto out;
case IPV4ACD_STATE_ANNOUNCING:
case IPV4ACD_STATE_RUNNING:
goto out;
case IPV4ACD_STATE_PROBING:
out:
if (event)
goto out;
goto out;
goto out;
goto out;
goto out;
out: