lldp-port.c revision b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers This file is part of systemd.
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers Copyright (C) 2014 Tom Gundersen
8d451309667578d3a03cdfc91d6e339fb9fe64a7Kay Sievers Copyright (C) 2014 Susant Sahani
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers systemd is free software; you can redistribute it and/or modify it
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering under the terms of the GNU Lesser General Public License as published by
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers (at your option) any later version.
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers systemd is distributed in the hope that it will be useful, but
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers WITHOUT ANY WARRANTY; without even the implied warranty of
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering You should have received a copy of the GNU Lesser General Public License
1822350db15b089f094a6dbd2469842ab42c1d87Kay Sievers along with systemd; If not, see <http://www.gnu.org/licenses/>.
bb15fafe9cd815fe5bf9eae84c08aead2eb98fd7Lennart Poettering r = sd_event_add_io(p->event, &p->lldp_port_rx,
bb15fafe9cd815fe5bf9eae84c08aead2eb98fd7Lennart Poettering p->rawfd, EPOLLIN, lldp_receive_packet, p);
bb15fafe9cd815fe5bf9eae84c08aead2eb98fd7Lennart Poettering log_debug_errno(r, "Failed to allocate event source: %m");
ee104e11e303499a637c5cd8157bd12ad5cc116dLennart Poettering r = sd_event_source_set_priority(p->lldp_port_rx, p->event_priority);
d4f5a1f47dbd04f26f2ddf951c97c4cb0ebbbe62David Herrmann log_debug_errno(r, "Failed to set event priority: %m");
8d451309667578d3a03cdfc91d6e339fb9fe64a7Kay Sievers r = sd_event_source_set_description(p->lldp_port_rx, "lldp-port-rx");
8d451309667578d3a03cdfc91d6e339fb9fe64a7Kay Sievers if (r < 0) {
8d451309667578d3a03cdfc91d6e339fb9fe64a7Kay Sievers log_debug_errno(r, "Failed to set event name: %m");
8d451309667578d3a03cdfc91d6e339fb9fe64a7Kay Sievers p->lldp_port_rx = sd_event_source_unref(p->lldp_port_rx);