-#define _GNU_SOURCE 1
+/* -*- mode: c; c-file-style: "openbsd" -*- */
+/*
+ * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
struct packet *pkt;
in_addr_t addr;
struct lldpd_mgmt *mgmt;
+ struct lldpd cfg = {
+ .g_config = {
+ .c_platform = "Linux"
+ }
+ };
/* Populate port and chassis */
hardware.h_lport.p_id_subtype = LLDP_PORTID_SUBTYPE_IFNAME;
TAILQ_INSERT_TAIL(&chassis.c_mgmt, mgmt, m_entries);
/* Build packet */
- n = cdpv1_send(NULL, &hardware);
+ n = cdpv1_send(&cfg, &hardware);
if (n != 0) {
fail("unable to build packet");
return;
in_addr_t addr2;
struct lldpd_mgmt *mgmt1;
struct lldpd_mgmt *mgmt2;
+ struct lldpd cfg = {
+ .g_config = {
+ .c_platform = "Linux"
+ }
+ };
/* Populate port and chassis */
hardware.h_lport.p_id_subtype = LLDP_PORTID_SUBTYPE_LLADDR;
TAILQ_INSERT_TAIL(&chassis.c_mgmt, mgmt2, m_entries);
/* Build packet */
- n = cdpv2_send(NULL, &hardware);
+ n = cdpv2_send(&cfg, &hardware);
if (n != 0) {
fail("unable to build packet");
return;