From 0037c2dc54ca5bc5a3ec428619ff136066467565 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 24 Sep 2015 23:08:22 +0200 Subject: lldp: move lldp_receive_packet() to lldp-internal.c In order to implement tests for the LLDP state machine, we need to mock lldp_network_bind_raw_socket(). Move the other function lldp_receive_packet() to another file so that we can replace the first function with a custom one and keep the second one. --- src/libsystemd-network/lldp-network.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src/libsystemd-network/lldp-network.c') diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/lldp-network.c index 1c6dcae14d..12a6599ff1 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/lldp-network.c @@ -82,30 +82,3 @@ int lldp_network_bind_raw_socket(int ifindex) { return r; } - -int lldp_receive_packet(sd_event_source *s, int fd, uint32_t revents, void *userdata) { - _cleanup_lldp_packet_unref_ tlv_packet *packet = NULL; - tlv_packet *p; - uint16_t length; - int r; - - assert(fd); - assert(userdata); - - r = tlv_packet_new(&packet); - if (r < 0) - return r; - - length = read(fd, &packet->pdu, sizeof(packet->pdu)); - - /* Silently drop the packet */ - if ((size_t) length > ETHER_MAX_LEN) - return 0; - - packet->userdata = userdata; - - p = packet; - packet = NULL; - - return lldp_handle_packet(p, (uint16_t) length); -} -- cgit v1.2.3-54-g00ecf