Hello community, here is the log from the commit of package open-lldp for openSUSE:Factory checked in at 2020-10-10 19:03:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/open-lldp (Old) and /work/SRC/openSUSE:Factory/.open-lldp.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "open-lldp" Sat Oct 10 19:03:30 2020 rev:16 rq:840305 version:1.0.1+69.e8f522565f5a Changes: -------- --- /work/SRC/openSUSE:Factory/open-lldp/open-lldp.changes 2020-04-15 20:08:03.878169204 +0200 +++ /work/SRC/openSUSE:Factory/.open-lldp.new.4249/open-lldp.changes 2020-10-10 19:03:50.544467960 +0200 @@ -1,0 +2,32 @@ +Sun Sep 06 16:13:14 UTC 2020 - ldun...@suse.com + +- Update to version v1.0.1+69.e8f522565f5a to removed commpiler + and rpmlint complaints: + * Fix bash-completion dir: don't use /etc + * Fix compiler issue with strcpy(): use memcpy + * Fix compiler complaint argument type mismatch. + * Fix compiler complaint declaration vs function. + * Fix compiler complaint copying to packed member. + * add 'lldpad.socket' to the '%service_*' macros in the SPEC + file + +------------------------------------------------------------------- +Fri Sep 4 16:19:34 UTC 2020 - Lee Duncan <ldun...@suse.com> + +- Moved sources from github.com/intel to github/openSUSE + * upgrading to version v1.0.1+110.6009075a9fcc + - merged in latest upstream (no API changes) + +------------------------------------------------------------------- +Tue Aug 04 12:06:31 UTC 2020 - h...@suse.de + +- Update to version v1.0.1+63.f977e67 (bsc#1171284,bsc#1170745,bsc#1153520): + * lldp/rx.c: Reset state machine variable in process_delete_info() + * lldp: do not call 'assert' in rxProcessFrame() + * ecp: allow for failure to create + * lldp_mand: retrieve permanent mac address in get_mac() + * lldp_util: use netlink to fetch mac address + * lldp_util: drop get_macstr() + * linux/if_link.h: Update and add bonding netlink definitions + +------------------------------------------------------------------- @@ -16 +48 @@ - * l2_packet: Guard ETH_P_LLDP define + * l2_packet: Guard ETH_P_LLDP define (edit: fixes bsc#1156545) Old: ---- open-lldp-v1.0.1+102.4c7fcc3.tar.xz New: ---- open-lldp-v1.0.1+69.e8f522565f5a.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-lldp.spec ++++++ --- /var/tmp/diff_new_pack.sbTU3t/_old 2020-10-10 19:03:51.048468211 +0200 +++ /var/tmp/diff_new_pack.sbTU3t/_new 2020-10-10 19:03:51.052468213 +0200 @@ -21,7 +21,7 @@ Summary: Link Layer Discovery Protocol (LLDP) Agent License: GPL-2.0-only Group: System/Daemons -Version: 1.0.1+102.4c7fcc3 +Version: 1.0.1+69.e8f522565f5a Release: 0 BuildRequires: bison BuildRequires: flex @@ -91,16 +91,16 @@ %post %{fillup_only -n lldpad} -%service_add_post lldpad.service +%service_add_post lldpad.service lldpad.socket %pre -%service_add_pre lldpad.service +%service_add_pre lldpad.service lldpad.socket %preun -%service_del_preun lldpad.service +%service_del_preun lldpad.service lldpad.socket %postun -%service_del_postun lldpad.service +%service_del_postun lldpad.service lldpad.socket %post -n %libname -p /sbin/ldconfig @@ -115,7 +115,7 @@ %{_sbindir}/* %{_mandir}/man3/* %{_mandir}/man8/* -%config /etc/bash_completion.d/* +%{_datadir}/bash-completion/completions/* %files -n %libname %defattr(-,root,root) ++++++ _service ++++++ --- /var/tmp/diff_new_pack.sbTU3t/_old 2020-10-10 19:03:51.080468226 +0200 +++ /var/tmp/diff_new_pack.sbTU3t/_new 2020-10-10 19:03:51.084468229 +0200 @@ -8,6 +8,7 @@ <param name="versionformat">v1.0.1+@TAG_OFFSET@.%h</param> <param name="match-tag">v1.[0-9].[0-9]</param> <param name="changesgenerate">enable</param> + <param name="revision">sles15-sp2</param> </service> <service name="recompress" mode="disabled"> <param name="file">*open-lldp*.tar</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.sbTU3t/_old 2020-10-10 19:03:51.100468237 +0200 +++ /var/tmp/diff_new_pack.sbTU3t/_new 2020-10-10 19:03:51.104468238 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/openSUSE/lldpad.git</param> - <param name="changesrevision">4c7fcc339cca5ed6a0dabd3c017ca3dc6d6d765e</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">e8f522565f5a13832591a8a06d908c7671338102</param></service></servicedata> \ No newline at end of file ++++++ open-lldp-v1.0.1+102.4c7fcc3.tar.xz -> open-lldp-v1.0.1+69.e8f522565f5a.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/.travis.yml new/open-lldp-v1.0.1+69.e8f522565f5a/.travis.yml --- old/open-lldp-v1.0.1+102.4c7fcc3/.travis.yml 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,49 +0,0 @@ -language: c -dist: xenial -#before_install: sudo apt-get update -install: sudo apt-get install -y libconfig-dev libnl-3-dev rpm -before_script: ./bootstrap.sh -script: ./contrib/build-rpm.sh && ./configure && make && make test && sudo make install #&& rpmbuild -ba lldpad.spec - -matrix: - include: - - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-4.8 - env: - - CC="gcc-4.8" - - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-5 - env: - - CC="gcc-5" - - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-7 - env: - - CC="gcc-7" - - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-8 - env: - - CC="gcc-8" - - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-9 - env: - - CC="gcc-9" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/Makefile.am new/open-lldp-v1.0.1+69.e8f522565f5a/Makefile.am --- old/open-lldp-v1.0.1+102.4c7fcc3/Makefile.am 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/Makefile.am 2020-09-06 18:09:34.000000000 +0200 @@ -141,7 +141,7 @@ systemdsystemunitdir = $(prefix)/lib/systemd/system dist_systemdsystemunit_DATA = lldpad.service lldpad.socket -bashcompletiondir = $(sysconfdir)/bash_completion.d +bashcompletiondir = $(prefix)/share/bash-completion/completions dist_bashcompletion_DATA = contrib/bash_completion/lldpad contrib/bash_completion/lldptool AM_DISTCHECK_CONFIGURE_FLAGS = --enable-debug diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/configure.ac new/open-lldp-v1.0.1+69.e8f522565f5a/configure.ac --- old/open-lldp-v1.0.1+102.4c7fcc3/configure.ac 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/configure.ac 2020-09-06 18:09:34.000000000 +0200 @@ -25,39 +25,6 @@ AC_MSG_ERROR([no suitable flex found. Please install the 'flex' package.]) fi -dnl Begin determine the systemd use and location -PKG_CHECK_MODULES([SYSTEMD], [systemd], use_systemd=yes, use_systemd=no) - -dnl Set sysvinit values, if system has systemd it will be rewritten -AC_SUBST(SPEC_BUILD_REQUIRES_POST, "chkconfig") -AC_SUBST(SPEC_BUILD_REQUIRES_PREUN, "chkconfig initscripts") -AC_SUBST(SPEC_BUILD_REQUIRES_POSTUN, "initscripts") -specfile_install="%{_sysconfdir}/init.d/lldpad" -specfile_install_socket="" - -if test "x$use_systemd" == xyes; then - dir="" - AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystem unitdir=DIR], - [Directory for systemd service files default from pkg-config variable systemdsystemunitdir]), - [dir=${withval}], - [dir="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"]) - - systemdsystemunitdir=${dir} - AC_SUBST(SYSTEMD_SYSTEM_UNIT_DIR, [$systemdsystemunitdir]) - specfile_install="$systemdsystemunitdir/lldpad.service" - specfile_install_socket="$systemdsystemunitdir/lldpad.socket" - - AC_SUBST(SPEC_BUILD_REQUIRES_POST, "systemd") - AC_SUBST(SPEC_BUILD_REQUIRES_PREUN, "systemd") - AC_SUBST(SPEC_BUILD_REQUIRES_POSTUN, "systemd") -fi - -AM_CONDITIONAL(SYSTEMD_SYSTEM, test "x$use_systemd" == xyes) -AC_SUBST(SPEC_FILE_LLDPAD_SERVICE, $specfile_install) -AC_SUBST(SPEC_FILE_LLDPAD_SOCKET, $specfile_install_socket) -dnl End systemd stuff - PKG_CHECK_MODULES([LIBCONFIG], [libconfig >= 1.3.2]) PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.2]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/contrib/build-rpm.sh new/open-lldp-v1.0.1+69.e8f522565f5a/contrib/build-rpm.sh --- old/open-lldp-v1.0.1+102.4c7fcc3/contrib/build-rpm.sh 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/contrib/build-rpm.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -#!/bin/sh - -set -ev - -sources=~/rpmbuild/SOURCES -version="1.0.1" - -mkdir -p "$sources" -#git archive --prefix=lldpad-"$version"/ --format=tar.gz --output="$sources"/lldpad-"$version".tar.gz HEAD -tar --transform='s:^\.:lldpad-'"$version"':' --exclude='.git*' --exclude='.travis.yml' -cvzf "$sources"/lldpad-"$version".tar.gz . -#rpmbuild -ba lldpad.spec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/dcb_protocol.c new/open-lldp-v1.0.1+69.e8f522565f5a/dcb_protocol.c --- old/open-lldp-v1.0.1+102.4c7fcc3/dcb_protocol.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/dcb_protocol.c 2020-09-06 18:09:34.000000000 +0200 @@ -75,7 +75,7 @@ entry = (struct pg_store1 *)malloc(sizeof(struct pg_store1)); if (!entry) return; - STRNCPY_TERMINATED(entry->ifname, ifname, sizeof(entry->ifname)); + strncpy(entry->ifname, ifname, sizeof(entry->ifname)); entry->second = store; LIST_INSERT_HEAD(head, entry, entries); } @@ -1100,7 +1100,7 @@ assert(device_name); not_default = memcmp(DEF_CFG_STORE, device_name, strlen(DEF_CFG_STORE)); - STRNCPY_TERMINATED (devName, device_name, MAX_DEVICE_NAME_LEN); + strncpy (devName, device_name, MAX_DEVICE_NAME_LEN); if (not_default) handle_opermode_true(device_name); @@ -2260,12 +2260,10 @@ size = (int)strlen(it->second->pgid_desc[bwgid]) + sizeof(char); /* Localization OK */ *name = (char*)malloc(size); - if (*name != NULL) { - strncpy(*name, it->second->pgid_desc[bwgid], - size); /* Localization OK */ - } else { + if (*name == NULL) goto Error; - } + memcpy(*name, it->second->pgid_desc[bwgid], + size); /* Localization OK */ } else { result = get_persistent(device_name, &attribs); if (result == cmd_success) { @@ -2273,11 +2271,10 @@ attribs.descript.pgid_desc[bwgid]) + sizeof(char); *name = (char*)malloc(size); - if (*name != NULL) { - memcpy(*name, attribs.descript.pgid_desc[bwgid], size); /* Localization OK */ - } else { + if (*name == NULL) goto Error; - } + memcpy(*name, attribs.descript.pgid_desc[bwgid], + size); /* Localization OK */ } else { result = cmd_device_not_found; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/event_iface.c new/open-lldp-v1.0.1+69.e8f522565f5a/event_iface.c --- old/open-lldp-v1.0.1+102.4c7fcc3/event_iface.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/event_iface.c 2020-09-06 18:09:34.000000000 +0200 @@ -77,7 +77,7 @@ LLDPAD_DBG(" IFLA_BROADCAST\n"); break; case IFLA_IFNAME: - STRNCPY_TERMINATED(d, (char *)RTA_DATA(rta), IFNAMSIZ); + strncpy(d, (char *)RTA_DATA(rta), IFNAMSIZ); LLDPAD_DBG(" IFLA_IFNAME\n"); LLDPAD_DBG(" device name is %s\n", d); break; @@ -205,9 +205,6 @@ port = newport; } else if (is_bond(device_name) || !port->portEnabled) reinit_port(device_name); - else if (port->portEnabled) { - return 0; - } lldp_add_agent(device_name, NEAREST_BRIDGE); lldp_add_agent(device_name, NEAREST_NONTPMR_BRIDGE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/include/lldp.h new/open-lldp-v1.0.1+69.e8f522565f5a/include/lldp.h --- old/open-lldp-v1.0.1+102.4c7fcc3/include/lldp.h 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/include/lldp.h 2020-09-06 18:09:34.000000000 +0200 @@ -51,13 +51,6 @@ __x > __y ? __x : __y; \ }) -/* Use strncpy with N-1 and ensure the string is terminated. */ -#define STRNCPY_TERMINATED(DEST, SRC, N) \ - do { \ - strncpy (DEST, SRC, N - 1); \ - DEST[N - 1] = '\0'; \ - } while (false) - /* * Organizationally Unique Identifier (OUI) * http://standards.ieee.org/regauth/oui/oui.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/include/lldp_basman_clif.h new/open-lldp-v1.0.1+69.e8f522565f5a/include/lldp_basman_clif.h --- old/open-lldp-v1.0.1+102.4c7fcc3/include/lldp_basman_clif.h 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/include/lldp_basman_clif.h 2020-09-06 18:09:34.000000000 +0200 @@ -31,7 +31,7 @@ void basman_cli_unregister(struct lldp_module *); int basman_print_tlv(u32, u16, char *); -#define ARG_IPV4_ADDR "ipv4" -#define ARG_IPV6_ADDR "ipv6" -#define ARG_TLVINFO "info" +#define ARG_IPV4_ADDR "ipv4" +#define ARG_IPV6_ADDR "ipv6" + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp/l2_packet_linux.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp/l2_packet_linux.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp/l2_packet_linux.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp/l2_packet_linux.c 2020-09-06 18:09:34.000000000 +0200 @@ -169,7 +169,7 @@ if (l2 == NULL) return NULL; memset(l2, 0, sizeof(*l2)); - STRNCPY_TERMINATED(l2->ifname, ifname, sizeof(l2->ifname)); + strncpy(l2->ifname, ifname, sizeof(l2->ifname)); l2->rx_callback = rx_callback; l2->rx_callback_ctx = rx_callback_ctx; l2->l2_hdr = l2_hdr; @@ -183,7 +183,7 @@ return NULL; } - STRNCPY_TERMINATED(ifr.ifr_name, l2->ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, l2->ifname, sizeof(ifr.ifr_name)); if (ioctl(l2->fd, SIOCGIFINDEX, &ifr) < 0) { perror("ioctl[SIOCGIFINDEX]"); close(l2->fd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp/rx.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp/rx.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp/rx.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp/rx.c 2020-09-06 18:09:34.000000000 +0200 @@ -139,7 +139,16 @@ int err; struct lldp_module *np; - assert(agent->rx.framein && agent->rx.sizein); + if (!agent->rx.framein) { + LLDPAD_DBG("ERROR - agent framein not set, " + "has the neighbour MAC changed? " + "Ignoring packet.\n"); + return; + } + if (!agent->rx.sizein) { + LLDPAD_DBG("Size-0 packet received, ignoring packet\n"); + return; + } agent->lldpdu = 0; agent->rx.dupTlvs = 0; @@ -559,6 +568,7 @@ agent->rx.sizein = 0; agent->rx.remoteChange = true; + agent->rx.rcvFrame = false; return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8021qaz.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8021qaz.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8021qaz.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8021qaz.c 2020-09-06 18:09:34.000000000 +0200 @@ -50,7 +50,6 @@ struct lldp_head lldp_head; struct config_t lldpad_cfg; -extern bool read_only_8021qaz; static int ieee8021qaz_check_pending(struct port *port, struct lldp_agent *); static void run_all_sm(struct port *port, struct lldp_agent *agent); @@ -592,7 +591,7 @@ memset(tlvs->rx, 0, sizeof(*tlvs->rx)); /* Initializing the ieee8021qaz_tlvs struct */ - STRNCPY_TERMINATED(tlvs->ifname, ifname, IFNAMSIZ); + strncpy(tlvs->ifname, ifname, IFNAMSIZ); tlvs->port = port; tlvs->ieee8021qazdu = 0; l2_packet_get_own_src_addr(port->l2, tlvs->local_mac); @@ -961,9 +960,6 @@ .dcb_pad = 0 }; - if (read_only_8021qaz) - return 0; - nlsocket = nl_socket_alloc(); if (!nlsocket) { LLDPAD_WARN("%s: %s: nl_handle_alloc failed\n", @@ -1047,9 +1043,6 @@ .dcb_pad = 0 }; - if (read_only_8021qaz) - return 0; - nlsocket = nl_socket_alloc(); if (!nlsocket) { LLDPAD_WARN("%s: %s: nl_handle_alloc failed\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8021qaz_clif.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8021qaz_clif.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8021qaz_clif.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8021qaz_clif.c 2020-09-06 18:09:34.000000000 +0200 @@ -251,70 +251,40 @@ static void ieee8021qaz_print_app_tlv(u16 len, char *info) { - u8 app, app_idx, app_prio, app_sel; - u16 proto, offset = 2; - u8 dscp[MAX_USER_PRIORITIES][MAX_APP_ENTRIES]; - u8 dscp_count[MAX_USER_PRIORITIES] = {0}; - u8 i, j; - bool first_app = true; + u16 offset = 2; + u8 app; + u16 proto; while (offset < len*2) { hexstr2bin(info + offset, &app, 1); hexstr2bin(info + offset + 2, (u8 *)&proto, 2); - app_idx = offset/6; - app_prio = (app & 0xE0) >> 5; - app_sel = app & 0x07; - - // Selector five is DSCP. Save value to print table at the end - if (app_sel == 5) { - dscp[app_prio][dscp_count[app_prio]] = ntohs(proto) & 0x3F; - dscp_count[app_prio]++; - } else { - if (first_app) - first_app = false; - else - printf("\t"); - printf("App# %3i \t Prio %1i \t Sel %1i \t P-ID", - app_idx, app_prio, app_sel); - - switch (app_sel) { - case 1: - printf("\t Ethertype: 0x%04x\n", ntohs(proto)); - break; - case 2: - printf("\t {S}TCP Port: %i\n", ntohs(proto)); - break; - case 3: - printf("\t UDP or DCCP Port: %i\n", ntohs(proto)); - break; - case 4: - printf("\t TCP/STCP/UDP/DCCP Port: %i\n", ntohs(proto)); - break; - default: - printf("\t Reserved Port: %i\n", ntohs(proto)); - break; - } + if (offset > 6) + printf("\t"); + printf("App#%i:\n", offset/6); + printf("\t Priority: %i\n", (app & 0xE0) >> 5); + printf("\t Sel: %i\n", app & 0x07); + switch (app & 0x07) { + case 1: + printf("\t Ethertype: 0x%04x\n", ntohs(proto)); + break; + case 2: + printf("\t {S}TCP Port: %i\n", ntohs(proto)); + break; + case 3: + printf("\t UDP or DCCP Port: %i\n", ntohs(proto)); + break; + case 4: + printf("\t TCP/STCP/UDP/DCCP Port: %i\n", ntohs(proto)); + break; + default: + printf("\t Reserved Port: %i\n", ntohs(proto)); + break; } + printf("\n"); offset += 6; } - - for(i=0; i<MAX_USER_PRIORITIES; i++) { - if (dscp_count[i] == 0) - continue; - - if (first_app) - first_app = false; - else - printf("\t"); - printf("Prio:%i \t dscp: ", i); - - for(j=0; j<dscp_count[i]; j++) { - printf(" %02i,", dscp[i][j]); - } - printf("\b \n"); - } } int ieee8021qaz_print_tlv(u32 tlvid, u16 len, char *info) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8023.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8023.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_8023.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_8023.c 2020-09-06 18:09:34.000000000 +0200 @@ -447,7 +447,7 @@ goto out_err; } memset(bd, 0, sizeof(struct ieee8023_data)); - STRNCPY_TERMINATED(bd->ifname, ifname, IFNAMSIZ); + strncpy(bd->ifname, ifname, IFNAMSIZ); bd->agenttype = agent->type; if (ieee8023_bld_tlv(bd, agent)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_basman.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_basman.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_basman.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_basman.c 2020-09-06 18:09:34.000000000 +0200 @@ -679,7 +679,7 @@ goto out_err; } memset(bd, 0, sizeof(struct basman_data)); - STRNCPY_TERMINATED(bd->ifname, ifname, IFNAMSIZ); + strncpy(bd->ifname, ifname, IFNAMSIZ); bd->agenttype = agent->type; if (basman_bld_tlv(bd, agent)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_basman_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_basman_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_basman_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_basman_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -51,9 +51,6 @@ static int get_arg_tlvtxenable(struct cmd *, char *, char *, char *, int); static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int); static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int); -static int get_arg_info(struct cmd *, char *, char *, char *, int); -static int set_arg_info(struct cmd *, char *, char *, char *, int); -static int test_arg_info(struct cmd *, char *, char *, char *, int); static struct arg_handlers arg_handlers[] = { { .arg = ARG_IPV4_ADDR, .arg_class = TLV_ARG, @@ -68,10 +65,6 @@ .handle_get = get_arg_tlvtxenable, .handle_set = set_arg_tlvtxenable, .handle_test = test_arg_tlvtxenable }, - { .arg = ARG_TLVINFO, .arg_class = TLV_ARG, - .handle_get = get_arg_info, - .handle_set = set_arg_info, - .handle_test = test_arg_info }, { .arg = 0 } }; @@ -173,89 +166,6 @@ return _set_arg_tlvtxenable(cmd, arg, argvalue, obuf, obuf_len, true); } -static int get_arg_info(struct cmd *cmd, char *arg, UNUSED char *argvalue, - char *obuf, int obuf_len) -{ - const char *info_str = NULL; - char arg_path[256]; - - if (cmd->cmd != cmd_gettlv) - return cmd_invalid; - - switch (cmd->tlvid) { - case PORT_DESCRIPTION_TLV: - case SYSTEM_NAME_TLV: - case SYSTEM_DESCRIPTION_TLV: - case SYSTEM_CAPABILITIES_TLV: - case MANAGEMENT_ADDRESS_TLV: - snprintf(arg_path, sizeof(arg_path), "%s%08x.%s", - TLVID_PREFIX, cmd->tlvid, arg); - - get_config_setting(cmd->ifname, cmd->type, arg_path, - &info_str, CONFIG_TYPE_STRING); - break; - case INVALID_TLVID: - return cmd_invalid; - default: - return cmd_not_applicable; - } - - if (info_str) - snprintf(obuf, obuf_len, "%02x%s%04x%s", - (unsigned int)strlen(arg), arg, - (unsigned int)strlen(info_str), info_str); - - return cmd_success; -} - -static int _set_arg_info(struct cmd *cmd, UNUSED char *arg, char *argvalue, - char *obuf, int obuf_len, bool test) -{ - if (cmd->cmd != cmd_settlv) - return cmd_invalid; - - switch (cmd->tlvid) { - case PORT_DESCRIPTION_TLV: - case SYSTEM_NAME_TLV: - case SYSTEM_DESCRIPTION_TLV: - case SYSTEM_CAPABILITIES_TLV: - case MANAGEMENT_ADDRESS_TLV: - break; - case INVALID_TLVID: - return cmd_invalid; - default: - return cmd_not_applicable; - } - - if (strlen(argvalue) < 1) - return cmd_invalid; - - if (test) - return cmd_success; - - if (set_config_tlvinfo_str(cmd->ifname, cmd->type, - cmd->tlvid, argvalue)) - return cmd_failed; - - snprintf(obuf, obuf_len, "enableTx = %s\n", argvalue); - - somethingChangedLocal(cmd->ifname, cmd->type); - - return cmd_success; -} - -static int set_arg_info(struct cmd *cmd, char *arg, char *argvalue, - char *obuf, int obuf_len) -{ - return _set_arg_info(cmd, arg, argvalue, obuf, obuf_len, false); -} - -static int test_arg_info(struct cmd *cmd, char *arg, char *argvalue, - char *obuf, int obuf_len) -{ - return _set_arg_info(cmd, arg, argvalue, obuf, obuf_len, true); -} - struct arg_handlers *basman_get_arg_handlers() { return &arg_handlers[0]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_dcbx.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_dcbx.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_dcbx.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_dcbx.c 2020-09-06 18:09:34.000000000 +0200 @@ -582,7 +582,7 @@ memset(manifest, 0, sizeof(*manifest)); tlvs->manifest = manifest; - STRNCPY_TERMINATED(tlvs->ifname, ifname, IFNAMSIZ); + strncpy(tlvs->ifname, ifname, IFNAMSIZ); tlvs->port = port; tlvs->dcbdu = 0; tlvs->dcbx_st = gdcbx_subtype & MASK_DCBX_FORCE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_dcbx_nl.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_dcbx_nl.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_dcbx_nl.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_dcbx_nl.c 2020-09-06 18:09:34.000000000 +0200 @@ -561,7 +561,7 @@ seq = nlh->nlmsg_seq; - STRNCPY_TERMINATED (name, ifname, sizeof(name)); + strncpy(name, ifname, sizeof(name)); add_rta(nlh, DCB_ATTR_IFNAME, (void *)name, strlen(name) + 1); rta_parent = add_rta(nlh, DCB_ATTR_NUMTCS, NULL, 0); @@ -801,6 +801,17 @@ return(recv_msg(DCB_CMD_SAPP, DCB_ATTR_APP, seq)); } +int run_cmd(char *cmd, ...) +{ + char cbuf[128]; + va_list args; + + va_start(args, cmd); + vsprintf(cbuf, cmd, args); + va_end(args); + return system(cbuf); +} + int set_hw_all(char *ifname) { struct nlmsghdr *nlh; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb.c 2020-09-06 18:09:34.000000000 +0200 @@ -342,7 +342,7 @@ __func__, ifname, agent->type, sizeof(*ed)); return; } - STRNCPY_TERMINATED(ed->ifname, ifname, IFNAMSIZ); + strncpy(ed->ifname, ifname, IFNAMSIZ); ed->agenttype = agent->type; evb_init_tlv(ed, agent); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb22.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb22.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb22.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb22.c 2020-09-06 18:09:34.000000000 +0200 @@ -450,7 +450,7 @@ __func__, ifname, agent->type, sizeof *ed); return; } - STRNCPY_TERMINATED(ed->ifname, ifname, IFNAMSIZ); + strncpy(ed->ifname, ifname, IFNAMSIZ); ed->agenttype = agent->type; evb22_init_tlv(ed, agent); ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB22); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb22_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb22_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb22_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb22_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -244,7 +244,7 @@ { struct evb22_data *ed; char *s; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; @@ -265,7 +265,7 @@ { char arg_path[EVB_BUF_SIZE]; struct evb22_data *ed; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_settlv); u8 mode; if (good_cmd != cmd_success) @@ -369,7 +369,7 @@ int value; char arg_path[EVB_BUF_SIZE]; struct evb22_data *ed; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -404,7 +404,7 @@ { struct evb22_data *ed; char *s; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; @@ -557,7 +557,7 @@ struct evb22_data *ed; int value; char *endp; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -589,7 +589,7 @@ { struct evb22_data *ed; char s[EVB_BUF_SIZE]; - cmd_status good_cmd = evb22_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb22_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_evb_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_evb_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -185,7 +185,7 @@ get_arg_tlvtxenable(struct cmd *cmd, char *arg, UNUSED char *argvalue, char *obuf, int obuf_len) { - cmd_status good_cmd = evb_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_gettlv); char *s, arg_path[EVB_BUF_SIZE]; int value; @@ -214,7 +214,7 @@ int value; char arg_path[EVB_BUF_SIZE]; struct evb_data *ed; - cmd_status good_cmd = evb_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -280,7 +280,7 @@ static int get_arg_fmode(struct cmd *cmd, char *arg, UNUSED char *argvalue, char *obuf, int obuf_len) { - cmd_status good_cmd = evb_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_gettlv); char *s; u8 mode; @@ -303,7 +303,7 @@ u8 smode = 0; char arg_path[EVB_BUF_SIZE]; struct evb_data *ed; - cmd_status good_cmd = evb_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -362,7 +362,7 @@ int comma = 0; char t[EVB_BUF_SIZE]; u8 scap; - cmd_status good_cmd = evb_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; @@ -428,7 +428,7 @@ u8 scap = 0; char arg_path[EVB_BUF_SIZE]; struct evb_data *ed; - cmd_status good_cmd = evb_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -479,7 +479,7 @@ { char s[EVB_BUF_SIZE]; u8 rte; - cmd_status good_cmd = evb_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; @@ -500,7 +500,7 @@ int value; char arg_path[EVB_BUF_SIZE]; struct evb_data *ed = NULL; - cmd_status good_cmd = evb_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; @@ -550,7 +550,7 @@ { char s[EVB_BUF_SIZE]; u16 svsi; - cmd_status good_cmd = evb_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_gettlv); if (good_cmd != cmd_success) return good_cmd; @@ -569,7 +569,7 @@ int value; char arg_path[EVB_BUF_SIZE]; struct evb_data *ed; - cmd_status good_cmd = evb_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = evb_cmdok(cmd, (cmd_status)cmd_settlv); if (good_cmd != cmd_success) return good_cmd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_mand.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_mand.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_mand.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_mand.c 2020-09-06 18:09:34.000000000 +0200 @@ -111,14 +111,16 @@ struct tlv_info_chassis *chassis) { unsigned int len; + struct in_addr addr_v4; + struct in6_addr addr_v6; - void *v4_ptr = &chassis->id.na.ip.v4; - void *v6_ptr = &chassis->id.na.ip.v6; - if (!get_ipaddr(md->ifname, v4_ptr)) { + if (!get_ipaddr(md->ifname, &addr_v4)) { + chassis->id.na.ip.v4 = addr_v4; chassis->sub = CHASSIS_ID_NETWORK_ADDRESS; chassis->id.na.type = MANADDR_IPV4; len = sizeof(chassis->id.na.ip.v4); - } else if (!get_ipaddr6(md->ifname, v6_ptr)) { + } else if (!get_ipaddr6(md->ifname, &addr_v6)) { + chassis->id.na.ip.v6 = addr_v6; chassis->sub = CHASSIS_ID_NETWORK_ADDRESS; chassis->id.na.type = MANADDR_IPV6; len = sizeof(chassis->id.na.ip.v6); @@ -313,6 +315,8 @@ char arg_path[512] = { 0 }; struct unpacked_tlv *tlv; struct tlv_info_portid portid; + struct in_addr addr_v4; + struct in6_addr addr_v6; /* build only once */ @@ -373,10 +377,10 @@ break; } /* FALLTHROUGH */ - case PORT_ID_NETWORK_ADDRESS: { + case PORT_ID_NETWORK_ADDRESS: /* uses ipv4 first */ - void *v4_ptr = &portid.id.na.ip.v4; - if (!get_ipaddr(md->ifname, v4_ptr)) { + if (!get_ipaddr(md->ifname, &addr_v4)) { + portid.id.na.ip.v4 = addr_v4; portid.sub = PORT_ID_NETWORK_ADDRESS; portid.id.na.type = MANADDR_IPV4; length = sizeof(portid.id.na.type) + @@ -385,8 +389,8 @@ break; } /* ipv4 fails, get ipv6 */ - void *v6_ptr = &portid.id.na.ip.v6; - if (!get_ipaddr6(md->ifname, v6_ptr)) { + if (!get_ipaddr6(md->ifname, &addr_v6)) { + portid.id.na.ip.v6 = addr_v6; portid.sub = PORT_ID_NETWORK_ADDRESS; portid.id.na.type = MANADDR_IPV6; length = sizeof(portid.id.na.type) + @@ -394,7 +398,6 @@ sizeof(portid.sub); break; } - } /* FALLTHROUGH */ case PORT_ID_INTERFACE_NAME: portid.sub = PORT_ID_INTERFACE_NAME; @@ -605,7 +608,7 @@ return; } memset(md, 0, sizeof(struct mand_data)); - STRNCPY_TERMINATED(md->ifname, ifname, IFNAMSIZ); + strncpy(md->ifname, ifname, IFNAMSIZ); md->agenttype = agent->type; mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MAND); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_mand_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_mand_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_mand_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_mand_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -44,9 +44,6 @@ #include "lldp/states.h" #include "lldp_util.h" #include "messages.h" -#include "lldp_8021qaz.h" - -extern bool read_only_8021qaz; static int get_arg_adminstatus(struct cmd *, char *, char *, char *, int); static int set_arg_adminstatus(struct cmd *, char *, char *, char *, int); @@ -598,9 +595,6 @@ continue; if (!(ah = np->ops->get_arg_handler())) continue; - /* 8021QAZ set operations not allowed in read-only mode */ - if (np->id == LLDP_MOD_8021QAZ && read_only_8021qaz) - return cmd_no_access; while (ah->arg) { if (!strcasecmp(ah->arg, arg) && ah->handle_test) { rval = ah->handle_test(cmd, ah->arg, argvalue, @@ -631,9 +625,6 @@ continue; if (!(ah = np->ops->get_arg_handler())) continue; - /* 8021QAZ set operations not allowed in read-only mode */ - if (np->id == LLDP_MOD_8021QAZ && read_only_8021qaz) - return cmd_no_access; while (ah->arg) { if (!strcasecmp(ah->arg, arg) && ah->handle_set) { rval = ah->handle_set(cmd, ah->arg, argvalue, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_med.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_med.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_med.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_med.c 2020-09-06 18:09:34.000000000 +0200 @@ -905,7 +905,7 @@ goto out_err; } memset(md, 0, sizeof(struct med_data)); - STRNCPY_TERMINATED(md->ifname, ifname, IFNAMSIZ); + strncpy(md->ifname, ifname, IFNAMSIZ); md->agenttype = agent->type; if (med_bld_tlv(md, agent)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldp_util.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_util.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldp_util.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldp_util.c 2020-09-06 18:09:34.000000000 +0200 @@ -366,7 +366,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&ifr, 0, sizeof(ifr)); - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCGIFFLAGS, &ifr) == 0) flags = ifr.ifr_flags; } @@ -402,7 +402,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&ifr, 0, sizeof(ifr)); - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCGIFPFLAGS, &ifr) == 0) flags = ifr.ifr_flags; } @@ -486,7 +486,7 @@ memset(&ifr, 0, sizeof(ifr)); memset(&ifb, 0, sizeof(ifb)); - STRNCPY_TERMINATED(ifr.ifr_name, ifmaster, IFNAMSIZ); + strncpy(ifr.ifr_name, ifmaster, IFNAMSIZ); ifr.ifr_data = (caddr_t)&ifb; if (ioctl(fd, SIOCBONDINFOQUERY, &ifr)) goto out_done; @@ -516,7 +516,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&ifreq, 0, sizeof(ifreq)); - STRNCPY_TERMINATED(ifreq.ifr_name, ifname, IFNAMSIZ); + strncpy(ifreq.ifr_name, ifname, IFNAMSIZ); if (ioctl(fd, SIOCGIFINDEX, &ifreq) == 0) idx = ifreq.ifr_ifindex; } @@ -588,7 +588,7 @@ (unsigned long) &bi, 0, 0 }; ifr.ifr_data = (char *)args; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCDEVPRIVATE, &ifr) == 0) rc = 1; } @@ -626,7 +626,7 @@ if (fd >= 0) { memset(&ifv, 0, sizeof(ifv)); ifv.cmd = GET_VLAN_REALDEV_NAME_CMD; - STRNCPY_TERMINATED(ifv.device1, ifname, sizeof(ifv.device1)); + strncpy(ifv.device1, ifname, sizeof(ifv.device1)); if (ioctl(fd, SIOCGIFVLAN, &ifv) == 0) rc = 1; } @@ -653,7 +653,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&iwreq, 0, sizeof(iwreq)); - STRNCPY_TERMINATED(iwreq.ifr_name, ifname, sizeof(iwreq.ifr_name)); + strncpy(iwreq.ifr_name, ifname, sizeof(iwreq.ifr_name)); if (ioctl(fd, SIOCGIWNAME, &iwreq) == 0) rc = 1; } @@ -772,7 +772,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&ifr, 0, sizeof(ifr)); - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCGIFFLAGS, &ifr) == 0) if (ifr.ifr_flags & IFF_UP) rc = 1; @@ -793,7 +793,7 @@ memset(&cmd, 0, sizeof(cmd)); cmd.cmd = ETHTOOL_GSET; ifr.ifr_data = &cmd; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) if (cmd.supported & SUPPORTED_Autoneg) rc = 1; @@ -814,7 +814,7 @@ memset(&cmd, 0, sizeof(cmd)); cmd.cmd = ETHTOOL_GSET; ifr.ifr_data = &cmd; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) rc = cmd.autoneg; } @@ -851,7 +851,7 @@ memset(&cmd, 0, sizeof(cmd)); cmd.cmd = ETHTOOL_GSET; ifr.ifr_data = &cmd; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) { if (cmd.advertising & ADVERTISED_10baseT_Half) caps |= MAUCAPADV_b10baseT; @@ -890,7 +890,7 @@ memset(&cmd, 0, sizeof(cmd)); cmd.cmd = ETHTOOL_GSET; ifr.ifr_data = &cmd; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) { /* TODO: too many dot3MauTypes, * should check duplex, speed, and port */ @@ -917,7 +917,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { memset(&ifr, 0, sizeof(ifr)); - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCGIFMTU, &ifr) == 0) rc = ifr.ifr_mtu; } @@ -1064,7 +1064,7 @@ fd = get_ioctl_socket(); if (fd >= 0) { ifr.ifr_addr.sa_family = AF_INET; - STRNCPY_TERMINATED(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(fd, SIOCGIFADDR, &ifr) == 0) { memcpy(saddr, &ifr.ifr_addr, sizeof(*saddr)); rc = 0; @@ -1105,11 +1105,9 @@ rc = getifaddrs(&ifaddr); if (rc == 0) { - rc = -1; for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { - if (strncmp(ifa->ifa_name, ifname, IFNAMSIZ)) - continue; - if (ifa->ifa_addr && (ifa->ifa_addr->sa_family == AF_INET6)) { + if ((ifa->ifa_addr->sa_family == AF_INET6) && + (strncmp(ifa->ifa_name, ifname, IFNAMSIZ) == 0)) { memcpy(saddr, ifa->ifa_addr, sizeof(*saddr)); rc = 0; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldpad.c new/open-lldp-v1.0.1+69.e8f522565f5a/lldpad.c --- old/open-lldp-v1.0.1+102.4c7fcc3/lldpad.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldpad.c 2020-09-06 18:09:34.000000000 +0200 @@ -84,7 +84,6 @@ bool daemonize = 0; int loglvl = LOG_WARNING; int omit_tstamp; -bool read_only_8021qaz = false; static const char *lldpad_version = "lldpad v" VERSION_STR "\n" @@ -137,8 +136,7 @@ " -t omit timestamps in log messages\n" " -v show version\n" " -f use configfile instead of default\n" - " -V set syslog level\n" - " -R run 8021qaz module in read_only mode\n"); + " -V set syslog level\n"); exit(1); } @@ -238,7 +236,7 @@ int rc = 1; for (;;) { - c = getopt(argc, argv, "hdksptvf:RV:"); + c = getopt(argc, argv, "hdksptvf:V:"); if (c < 0) break; switch (c) { @@ -261,9 +259,6 @@ case 'p': pid_file = 0; break; - case 'R': - read_only_8021qaz = true; - break; case 't': omit_tstamp = 1; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/lldpad.spec.in new/open-lldp-v1.0.1+69.e8f522565f5a/lldpad.spec.in --- old/open-lldp-v1.0.1+102.4c7fcc3/lldpad.spec.in 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/lldpad.spec.in 2020-09-06 18:09:34.000000000 +0200 @@ -10,9 +10,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # BuildRequires: -Requires(post): @SPEC_BUILD_REQUIRES_POST@ -Requires(preun): @SPEC_BUILD_REQUIRES_PREUN@ -Requires(postun): @SPEC_BUILD_REQUIRES_POSTUN@ +Requires(post): chkconfig +Requires(preun): chkconfig initscripts +Requires(postun): initscripts %description This package contains the Linux user space daemon and configuration tool for @@ -46,36 +46,20 @@ %post -if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then - /sbin/chkconfig --add %{name} -fi -if type systemctl >/dev/null 2>&1; then - # Scriplet only runs preset. Run enable/start manually - %systemd_post %{name}.socket %{name}.service -fi +/sbin/chkconfig --add lldpad %preun if [ $1 = 0 ]; then - if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then - /sbin/service %{name} stop - /sbin/chkconfig --del %{name} - fi - if type systemctl >/dev/null 2>&1; then - %systemd_preun %{name}.service %{name}.socket - fi + /sbin/service lldpad stop + /sbin/chkconfig --del lldpad fi %postun if [ $1 = 1 ]; then - # Package upgrade, not uninstall - if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then - /sbin/service %{name} condrestart - fi - if type systemctl >/dev/null 2>&1; then - %systemd_postun_with_restart %{name}.socket %{name}.service - fi + /sbin/service lldpad condrestart fi + %files %defattr(-,root,root,-) %doc COPYING @@ -83,13 +67,11 @@ %doc ChangeLog %{_sbindir}/* %dir /var/lib/lldpad -@SPEC_FILE_LLDPAD_SERVICE@ -@SPEC_FILE_LLDPAD_SOCKET@ -%{_sysconfdir}/bash_completion.d/lldpad -%{_sysconfdir}/bash_completion.d/lldptool +%{_sysconfdir}/init.d/lldpad +%{_datadir}/bash-completion/completions/lldpad +%{_datadir}/bash-completion/completions/lldptool %{_mandir}/man8/* %{_libdir}/liblldp_clif.* -%{_mandir}/man3/liblldp_clif-vdp22.* %files devel %defattr(-,root,root,-) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/ecp.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/ecp.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/ecp.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/ecp.c 2020-09-06 18:09:34.000000000 +0200 @@ -795,7 +795,7 @@ __func__, ifname); return -1; } - STRNCPY_TERMINATED(vd->ecp.ifname, ifname, sizeof vd->ecp.ifname); + strncpy(vd->ecp.ifname, ifname, sizeof vd->ecp.ifname); ecp_rx_change_state(vd, ECP_RX_IDLE); ecp_rx_run_sm(vd); ecp_somethingChangedLocal(vd, true); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/ecp22.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/ecp22.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/ecp22.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/ecp22.c 2020-09-06 18:09:34.000000000 +0200 @@ -749,7 +749,7 @@ ifname); return NULL; } - STRNCPY_TERMINATED(ecp->ifname, ifname, sizeof ecp->ifname); + strncpy(ecp->ifname, ifname, sizeof ecp->ifname); ecp->l2 = l2_packet_init(ecp->ifname, 0, ETH_P_ECP22, ecp22_rx_receiveframe, ecp, 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp.c 2020-09-06 18:09:34.000000000 +0200 @@ -879,7 +879,7 @@ { switch(profile->state) { case VSI_UNASSOCIATED: - if (profile->mode == VDP_MODE_DEASSOCIATE) { + if ((profile->mode == VDP_MODE_DEASSOCIATE)) /* || (INACTIVE)) */ { vdp_vsi_change_bridge_state(profile, VSI_DEASSOC_PROCESSING); return true; } else if (profile->mode == VDP_MODE_ASSOCIATE) { @@ -1607,7 +1607,7 @@ __func__, ifname, sizeof(*vd)); goto out_err; } - STRNCPY_TERMINATED(vd->ifname, ifname, IFNAMSIZ); + strncpy(vd->ifname, ifname, IFNAMSIZ); vd->role = VDP_ROLE_STATION; vd->enabletx = enabletx; @@ -1882,7 +1882,7 @@ if (!macp->req_pid) return 0; sleep(1); /* Delay message notification */ - if (!profile->port || !profile->port->ifname[0]) { + if (!profile->port || !profile->port->ifname) { LLDPAD_ERR("%s: no ifname found for profile %p:\n", __func__, profile); goto error_exit; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp22.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp22.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp22.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp22.c 2020-09-06 18:09:34.000000000 +0200 @@ -834,7 +834,7 @@ ifname); return NULL; } - STRNCPY_TERMINATED(vdp->ifname, ifname, sizeof vdp->ifname); + strncpy(vdp->ifname, ifname, sizeof vdp->ifname); vdp->myrole = role; LIST_INIT(&vdp->vsi22_que); LIST_INSERT_HEAD(&eud->head, vdp, node); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp22_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp22_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp22_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp22_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -359,7 +359,7 @@ static int set_arg_vsi3(struct cmd *cmd, char *argvalue, bool test, int size, int oui_size) { - cmd_status good_cmd = vdp22_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = vdp22_cmdok(cmd, (cmd_status)cmd_settlv); int rc; struct vdpnl_vsi vsi; struct vdpnl_mac mac[size]; @@ -558,7 +558,7 @@ static int get_arg_vsi(struct cmd *cmd, char *arg, char *argvalue, char *obuf, int obuf_len) { - cmd_status good_cmd = vdp22_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = vdp22_cmdok(cmd, (cmd_status)cmd_gettlv); struct vdpnl_vsi vsi; char vsi_str[MAX_CLIF_MSGBUF]; int rc; @@ -577,7 +577,7 @@ memset(&vsi, 0, sizeof(vsi)); memset(vsi_str, 0, sizeof(vsi_str)); vsi.request = cmd->tlvid; - strncpy(vsi.ifname, cmd->ifname, sizeof(vsi.ifname)); + strncpy(vsi.ifname, cmd->ifname, sizeof(vsi.ifname) - 1); good_cmd = cmd_failed; if ((cmd->ops & op_config) && (cmd->ops & op_arg)) { memset(&mac, 0, sizeof(mac)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp_cmds.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp_cmds.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdp_cmds.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdp_cmds.c 2020-09-06 18:09:34.000000000 +0200 @@ -107,7 +107,7 @@ get_arg_tlvtxenable(struct cmd *cmd, char *arg, UNUSED char *argvalue, char *obuf, int obuf_len) { - cmd_status good_cmd = vdp_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = vdp_cmdok(cmd, (cmd_status)cmd_gettlv); int value; char *s; char arg_path[VDP_BUF_SIZE]; @@ -135,7 +135,7 @@ static int _set_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue, bool test) { - cmd_status good_cmd = vdp_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = vdp_cmdok(cmd, (cmd_status)cmd_settlv); int value, err; char arg_path[VDP_BUF_SIZE]; @@ -325,7 +325,7 @@ static int _set_arg_mode(struct cmd *cmd, char *argvalue, bool test) { - cmd_status good_cmd = vdp_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = vdp_cmdok(cmd, (cmd_status)cmd_settlv); struct vsi_profile *profile, *p; struct vdp_data *vd; @@ -376,7 +376,7 @@ static int get_arg_role(struct cmd *cmd, char *arg, UNUSED char *argvalue, char *obuf, int obuf_len) { - cmd_status good_cmd = vdp_cmdok(cmd, cmd_gettlv); + cmd_status good_cmd = vdp_cmdok(cmd, (cmd_status)cmd_gettlv); char arg_path[VDP_BUF_SIZE]; const char *p; @@ -397,7 +397,7 @@ static int _set_arg_role(struct cmd *cmd, char *arg, char *argvalue, bool test) { - cmd_status good_cmd = vdp_cmdok(cmd, cmd_settlv); + cmd_status good_cmd = vdp_cmdok(cmd, (cmd_status)cmd_settlv); struct vdp_data *vd; char arg_path[VDP_BUF_SIZE]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdpnl.c new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdpnl.c --- old/open-lldp-v1.0.1+102.4c7fcc3/qbg/vdpnl.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/qbg/vdpnl.c 2020-09-06 18:09:34.000000000 +0200 @@ -233,7 +233,7 @@ vsi->ifindex = ifinfo->ifi_index; if (tb[IFLA_IFNAME]) - STRNCPY_TERMINATED(vsi->ifname, (char *)RTA_DATA(tb[IFLA_IFNAME]), + strncpy(vsi->ifname, (char *)RTA_DATA(tb[IFLA_IFNAME]), sizeof vsi->ifname); else { if (!if_indextoname(ifinfo->ifi_index, vsi->ifname)) { @@ -304,9 +304,9 @@ size_t needed; needed = nla_total_size(sizeof(struct nlattr)) /* IFLA_VF_PORT */ - + nla_total_size(4) /* IFLA_PORT_VF */ - + nla_total_size(PORT_UUID_MAX) /* IFLA_PORT_INSTANCE_UUID */ - + nla_total_size(2); /* IFLA_PORT_RESPONSE */ + + nla_total_size(4); /* IFLA_PORT_VF */ + + nla_total_size(PORT_UUID_MAX); /* IFLA_PORT_INSTANCE_UUID */ + + nla_total_size(2); /* IFLA_PORT_RESPONSE */ return needed; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/test-driver new/open-lldp-v1.0.1+69.e8f522565f5a/test-driver --- old/open-lldp-v1.0.1+102.4c7fcc3/test-driver 2020-10-10 19:03:51.256468315 +0200 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/test-driver 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to /usr/share/automake-1.13/test-driver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/vdptool.c new/open-lldp-v1.0.1+69.e8f522565f5a/vdptool.c --- old/open-lldp-v1.0.1+102.4c7fcc3/vdptool.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/vdptool.c 2020-09-06 18:09:34.000000000 +0200 @@ -36,7 +36,6 @@ * set and query VSI profile settings. */ -#define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> #include <unistd.h> @@ -141,7 +140,7 @@ str = "TLV does not support agent type"; break; default: - str = print_vdp_status(status); + str = print_vdp_status((enum vdp22_cmd_status)status); break; } return str; @@ -179,7 +178,7 @@ static void fill_oui_hdr(vdptool_oui_data_t *oui_data, char *oui_name) { - STRNCPY_TERMINATED(oui_data->oui_name, oui_name, sizeof(oui_data->oui_name)); + strncpy(oui_data->oui_name, oui_name, sizeof(oui_data->oui_name)); snprintf(oui_data->data, sizeof(oui_data->data), "%02x%s", (unsigned int)strlen(oui_data->oui_name), oui_data->oui_name); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-lldp-v1.0.1+102.4c7fcc3/vdptool_cisco_oui.c new/open-lldp-v1.0.1+69.e8f522565f5a/vdptool_cisco_oui.c --- old/open-lldp-v1.0.1+102.4c7fcc3/vdptool_cisco_oui.c 2019-11-04 18:38:38.000000000 +0100 +++ new/open-lldp-v1.0.1+69.e8f522565f5a/vdptool_cisco_oui.c 2020-09-06 18:09:34.000000000 +0200 @@ -28,7 +28,7 @@ #include "lldp_util.h" #include "vdp_cisco.h" -bool cisco_oui_encode_hndlr(char *dst, char *src, int len) +bool cisco_oui_encode_hndlr(char *dst, char *src, size_t len) { char *src_temp = strdup(src); char *key, *data; @@ -47,7 +47,7 @@ if ((!strcmp(key, CISCO_OUI_NAME_ARG_STR)) || (!strcmp(key, CISCO_OUI_L3V4ADDR_ARG_STR)) || (!strcmp(key, CISCO_OUI_NAME_UUID_ARG_STR))) { - snprintf(dst, MAX_OUI_DATA_LEN - len, "%02x%s%04x%s", + snprintf(dst, MAX_OUI_DATA_LEN - (int)len, "%02x%s%04x%s", (unsigned int)strlen(key), key, (unsigned int)strlen(data), data); flag = true;