/***
This file is part of systemd.
Copyright (C) 2014 Tom Gundersen
Copyright (C) 2014 Susant Sahani
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "alloc-util.h"
#include "async.h"
#include "lldp-internal.h"
#include "lldp-network.h"
#include "lldp-port.h"
int r;
assert_return(p, -EINVAL);
r = lldp_network_bind_raw_socket(p->ifindex);
if (r < 0)
return r;
p->rawfd = r;
if (r < 0) {
log_debug_errno(r, "Failed to allocate event source: %m");
goto fail;
}
if (r < 0) {
log_debug_errno(r, "Failed to set event priority: %m");
goto fail;
}
if (r < 0) {
log_debug_errno(r, "Failed to set event name: %m");
goto fail;
}
return 0;
fail:
lldp_port_stop(p);
return r;
}
assert_return(p, -EINVAL);
return 0;
}
if (!p)
return;
lldp_port_stop(p);
free(p);
}
const char *ifname,
const struct ether_addr *addr,
void *userdata,
if (!p)
return -ENOMEM;
p->rawfd = -1;
if (!p->ifname)
return -ENOMEM;
*ret = p;
p = NULL;
return 0;
}