Codebase list lldpd / 3c83366
Imported Upstream version 0.7.14 Vincent Bernat 9 years ago
96 changed file(s) with 1895 addition(s) and 996 deletion(s). Raw diff Collapse all Expand all
0 0.7.11
0 0.7.14
0 0.7.14 [2015-04-04 16:29:39 +0200]:
1
2 - [1d56f873a9d5] release: prepare 0.7.14 (Vincent Bernat)
3 - [a8382e7f7aad] NEWS: add an entry to NEWS file for previous changes (Vincent Bernat)
4 - [f9ddfae82e8c] lib: update revision info to reflect ABI update of latest changes (Vincent Bernat)
5 - [8003e78962a6] lib: a change to port description is transmitted now (Vincent Bernat)
6 - [bbd094f4952c] client: when receiving a port update, transmit it now (Vincent Bernat)
7 - [332f8eea55d4] lldpcli: use "description" keyword when setting port description (Vincent Bernat)
8 - [50a978dce0a1] lldpcli: document ability to change port id and description (Vincent Bernat)
9 - [ec5a36012c23] lldpcli: ensure optional local port description cannot be repeated (Vincent Bernat)
10 - [b3eba1789914] Merge pull request #101 from commodo/port_label2 (Vincent Bernat)
11 - [abfea7d0be12] interfaces: management address is set to pattern on exact match (Vincent Bernat)
12 - [c267d0f2ab4f] lldpd: add port description override via lldpcli (Alexandru Ardelean)
13 - [8e46010cf12f] lldpd: implement basic support to override port IDs via lldpcli (Alexandru Ardelean)
14 - [0979d1ba0a3b] .gitignore: ignore vim swap files (Alexandru Ardelean)
15 - [81b171f47321] style: remove `if (...) free(...)` pattern (Vincent Bernat)
16 - [4db5e8c68d9a] interfaces: don't test for NULL before `free` (Vincent Bernat)
17 - [5683586ea1ef] priv: document improvement in crash handling in NEWS file (Vincent Bernat)
18 - [55764ecb9c62] Revert "priv: on Linux, when monitor dies, kill child" (Vincent Bernat)
19 - [a6128224ec0c] priv: use SOCK_STREAM for monitor communication (Vincent Bernat)
20 - [c53540ffc8e6] priv: don't log anything when handling SIGCHLD (Vincent Bernat)
21 - [004b5f944539] priv: ensure we write exactly what will be read (Vincent Bernat)
22 - [9475dd4c835e] ctl: create control socket with close-on-exec semantic (Vincent Bernat)
23 - [c642d8c7b9e4] priv: fallback to SOCK_DGRAM if SOCK_SEQPACKET not available (Vincent Bernat)
24 - [10c20ba8877e] priv: use a SOCK_SEQPACKET for communication with monitor (Vincent Bernat)
25 - [327b1d625c2d] priv: monitor the monitor process (Vincent Bernat)
26 - [a87db231990a] log: add token to all `fatalx` instances (Vincent Bernat)
27 - [4747e964096a] priv: on Linux, when monitor dies, kill child (Vincent Bernat)
28 - [50efc5f74521] event: don't remember (in cfg) control socket event (Vincent Bernat)
29 - [2bf63e5422e5] event: don't ignore SIGHUP twice (Vincent Bernat)
30 - [bdefcdb99044] build: don't use `sort -V` (Vincent Bernat)
31 - [eab6aa62d66d] check: add missing license headers to some files (Vincent Bernat)
32 - [1e264e08effe] check: fix SNMP test format error (Vincent Bernat)
33 - [a0cd2b9a3c68] check: more comparison with `ck_assert_ptr_eq()` (Vincent Bernat)
34 - [7afbe16a637d] check: compare pointers with `ck_assert_ptr_eq()` (Vincent Bernat)
35 - [47cd2807872a] check: enforce correct alignment during SNMP tests (Vincent Bernat)
36 - [c2af3a9cbd02] travis: don't configure with CFLAGS=-Werror (Vincent Bernat)
37 - [e6515ff5183d] configure: move LDFLAGS to LLDP_LDFLAGS (Vincent Bernat)
38 - [d627ab691987] configure: move CFLAGS/CPPFLAGS to LLDP_CFLAGS/LLDP_CPPFLAGS (Vincent Bernat)
39 - [a577598bb30b] configure: put cpp flags into CPPFLAGS instead of CFLAGS (Vincent Bernat)
40 - [630cc035fd82] configure: enforce the use of C99 (Vincent Bernat)
41 - [f215b5ec088b] Merge pull request #98 from baloo/features/document-lldp.d (Vincent Bernat)
42 - [fb0921ed2f43] client: document lldp.d configuration directory (Arthur Gautier)
43 - [63d2c3f8e547] interfaces: fallback to link local addresses for management (Vincent Bernat)
44 - [4b67a7b2829f] interfaces: exclude IPv4 link local addresses from management addresses (Vincent Bernat)
45 - [0c6a1966eead] interfaces: enforce redefinition of IN_IS_ADDR_* macros (Vincent Bernat)
46 - [28bf40220840] priv: don't lookup for _lldpd when privsep is disabled (Vincent Bernat)
47 - [aed91d90de68] lib: fix "unknwon" typo (Vincent Bernat)
48 - [e7b282ce5ca7] lib: fix compilation error when Dot3 is disabled (Vincent Bernat)
49 - [65e5293aeedf] priv: replace the use of `gethostbyname()` by `getaddrinfo()` (Vincent Bernat)
50 - [1fa7d39f5b9d] priv: rename "gethostbyname" priv function to "gethostname" (Vincent Bernat)
51 - [d162d7854659] build: use version sort for changelog (Vincent Bernat)
52 - [ac07e7e4a038] NEWS: add an entry for the two previous commits (Vincent Bernat)
53 - [78e82fcf01cc] lldp: fix boundary checks when decoding LLDP protocol identity (Vincent Bernat)
54 - [feed548d366d] lldp: fix boundary checks when decoding LLDP management address (Vincent Bernat)
55 - [17e55ef9b1b9] lldpcli: add "tagged" keyword to "configure med policy" (Vincent Bernat)
56 - [319ca87dc14f] travis: use stable NetSNMP from Homebrew (Vincent Bernat)
57 - [74da4061c4a9] libevent: enable silent rules by default (Vincent Bernat)
58 - [dc93bcaf9314] libevent: update embedded copy to 2.0.22-stable (Vincent Bernat)
59 - [efdd67188596] NEWS: add an entry for the two previous commits (Vincent Bernat)
60 - [e770b7204bf8] lldp: send a shutdown LLDPDU on exit (Vincent Bernat)
61 - [acb5f65b98b9] lldp: when MSAP changes, send a shutdown LLPDU (Vincent Bernat)
62 - [b1785ed5254b] marshal: don't marshal previous port value (Vincent Bernat)
63 - [9fb213a1b5ba] travis: don't compile embedded libevent + clang on OSX (Vincent Bernat)
64 - [5d74a4ec5afa] travis: don't fail on unused functions (second try) (Vincent Bernat)
65 - [8ef8a406fd03] travis: don't fail on unused functions (Vincent Bernat)
66 - [286513f665cc] travis: don't allow any warning or error (Vincent Bernat)
67
68 0.7.13 [2014-12-30 14:11:49 +0100]:
69
70 - [d9cf6428201b] version: prepare 0.7.13 release (Vincent Bernat)
71 - [135ff0f7fabb] configure: let define pkg-config directory with `--with-pkgconfigdir` (Vincent Bernat)
72 - [5a1f45863ed5] man: `-I` option and the like also affect sending (Vincent Bernat)
73 - [a3cae2a7299f] lldp: fix display of unknown organizational ID (Vincent Bernat)
74 - [17d341157926] lldpd: don't rely on a checksum to detect a port change (Vincent Bernat)
75 - [28414fbdbefb] lldpd: use a macro to define offset of permanent port info (Vincent Bernat)
76 - [da9c551a5511] NEWS: add an entry for the latest commit (Vincent Bernat)
77 - [59ca5ddb80fe] lldpd: fix coding style in latest commit (Vincent Bernat)
78 - [ea625620c6d6] Merge pull request #84 from IcyMetric/master (Vincent Bernat)
79 - [1c1c519fd71e] Allow setting control socket on CLI (Robert Long)
80 - [1f68881c2914] lldpd: decrease probability of collisions on port checksums (Vincent Bernat)
81 - [e172ee7b999a] lldpd: decrease probability of collisions on port checksums (Vincent Bernat)
82 - [24cce58cfc1b] lldpd: really ensure that port checksum can never be 0 (Vincent Bernat)
83 - [280f28da5153] lldpd: fix timer initialization when checksum is 0 (Vincent Bernat)
84 - [324d73a32c0a] marshal: ensure we correctly handle signed result from serialization (Vincent Bernat)
85 - [21832029366d] xml: check that libxml-2 is really usable (Vincent Bernat)
86 - [83d4b7761491] snmp: `agent_init()` won't modify AgentX string (Vincent Bernat)
87 - [4bfe49e965c5] lib: silent a warning about uninitialized value (Vincent Bernat)
88 - [fa1f3624463d] redhat: do not install the chroot (Vincent Bernat)
89 - [724dfcbd3919] redhat: requires pkg-config to build devel package (Vincent Bernat)
90
91 0.7.12 [2014-11-22 20:54:19 +0100]:
92
93 - [0882639dd155] release: prepare release of 0.7.12 (Vincent Bernat)
94 - [acdb7107e764] lib: fix pkgconfig file substitutions (Vincent Bernat)
95 - [63b4f1eede9e] client: fix "update" command (Vincent Bernat)
96 - [20f10b8dd3a2] travis: travis comes with autotools and friends already installed (Vincent Bernat)
97 - [2021a245926d] debian: update symbol versioning for incompatibility of `lldpctl_atom_set_str()` (Vincent Bernat)
98 - [18f7b3dbcea1] lib: bump versioning (Vincent Bernat)
99 - [ca8cfd460862] lib: make it safe to pass NULL to `lldpctl_atom_set_str()` (Vincent Bernat)
100 - [28431faeeafc] lib: document the possibility of using NULL with `lldpctl_atom_set_str()` (Vincent Bernat)
101 - [6dd83015cb74] lldpcli: allow to unset patterns and system description/hostname (Vincent Bernat)
102 - [7424351a7f80] lib: replace macro by a function for `_lldpctl_atom_set_str_config()` (Vincent Bernat)
103 - [8d91359cb371] lib: factor out some code in `_lldpctl_atom_set_str_config()` in a macro (Vincent Bernat)
104 - [22a5375576dd] NEWS: add an entry about some flags not being persistent accross time (Vincent Bernat)
105 - [cf33f40593b8] build: hide renaming of template-generated files (Vincent Bernat)
106 - [abc042057d9f] lldpd: use strdup() on arguments that could be changed by lldpcli (Vincent Bernat)
107 - [e4c51716848a] client: fix configuration modification (Vincent Bernat)
108 - [625005be708d] lldpcli: pretty print json (kanna)
109 - [dfa283134795] systemd: fix systemd unit file (Vincent Bernat)
110 - [8756eb67699c] debian: update symbols file (Vincent Bernat)
111 - [148a1efedcdf] interfaces: bond listening was broken only for old kernels (Vincent Bernat)
112 - [08ced6b4edf2] interfaces: fix initialization of hardware h_data for bonds (Vincent Bernat)
113 - [b96ca40c384a] frame: mention the licensing issue with POKE/PEEK macros (Vincent Bernat)
114 - [3ea0bccfdd4c] lldpcli: handle comments in tokenizer (Vincent Bernat)
115 - [5451aea8aa2f] Merge pull request #77 from Authority1980/master (Vincent Bernat)
116 - [e537ab772962] Fixed Changelog dates (Wes Hardin)
117 - [6d2c29c781db] lldpcli: don't complain when reading a commented line (Vincent Bernat)
118 - [c66fd1a55a68] redhat: mark /var/run stuff as a ghost directory (Vincent Bernat)
119 - [2e441b243656] redhat: fix group tag (Vincent Bernat)
120 - [b5b304e84702] redhat: provide a longer description for devel package (Vincent Bernat)
121 - [4ed3c3d8b5ab] redhat: fix RPM building on SuSE with respect to /usr/share/zsh (Vincent Bernat)
122 - [e202ae37e9f0] redhat: add completions for bash and zsh (Vincent Bernat)
123 - [c0e428aca21b] redhat: everything in /etc/lldpd.d is a configuration file (Vincent Bernat)
124 - [4fe6e6d026da] redhat: reference /etc/lldpd.d/README.conf (Vincent Bernat)
125 - [5cffb4e7a7ee] redhat: use appropriate macros for directory (Vincent Bernat)
126
0127 0.7.11 [2014-10-08 19:27:00 +0200]:
1128
2129 - [62446808f97a] release: prepare 0.7.11 (Vincent Bernat)
37164 - [0a735dedbdf7] zsh: add ZSH completion (Vincent Bernat)
38165 - [2136d8066293] bash: move bash completion outside Debian packaging (Vincent Bernat)
39166 - [3620ee09fa2f] release: new version 0.7.10 (Vincent Bernat)
167
168 0.7.10 [2014-07-21 18:06:54 +0200]:
169
40170 - [87ebf13df38c] NEWS: add a word about json-c library support (Vincent Bernat)
41171 - [5dcd280d1267] lldpcli: fix jansson implementation of the JSON output (Vincent Bernat)
42172 - [71542b4ec734] configure: if --with-json, default to jansson implementation (Vincent Bernat)
402532
403533 0.7.2 [2013-04-20 02:59:47 +0200]:
404534
405
406 0.7.11 [2014-10-08 19:27:00 +0200]:
407
408 - [62446808f97a] release: prepare 0.7.11 (Vincent Bernat)
409 - [3b0273eef9c3] man: sync lldpcli description of pattern matching (Vincent Bernat)
410 - [3af43e64a6cf] man: say that by default only physical interfaces are used (Vincent Bernat)
411 - [a2b113ef9d48] lldpd: check if capabilities are available/supported before enabling them (kanna)
412 - [71cc157933f6] build: hide invocation of sed command to generate some files (Vincent Bernat)
413 - [f24382c41668] lldpd: also try /usr/lib/os-release if /etc/os-release is not present (Vincent Bernat)
414 - [3a8e3db1d622] build: remove useless variables from pkgconfig file (Vincent Bernat)
415 - [e26fbbae1599] build: use @sbindir@ instead of @prefix@/sbin (Vincent Bernat)
416 - [95493844623c] build: use AC_CONFIG_FILES only to generate Makefiles (Vincent Bernat)
417 - [326808ff3c7c] debian: ship /etc/lldpd.d (Vincent Bernat)
418 - [7255aab1196e] client: ship /etc/lldpd.d and put a README file in it (Vincent Bernat)
419 - [c80ee6f068fe] build: allow use of older versions of json-c (Vincent Bernat)
420 - [d2badd57c3b6] lib: don't check for NULL before free (Vincent Bernat)
421 - [70f6059b9b7d] lib: make a copy of state_data, since pointer can be re-used (kanna)
422 - [ad7daaf7957e] debian: also install zsh completion (Vincent Bernat)
423 - [38ace3d484f8] debian: also install bash completion (Vincent Bernat)
424 - [9b11faad6fbb] lldpd: abort when some options are repeated (Vincent Bernat)
425 - [e37cdbe61624] Revert "debian: ship files in debian/etc/lldpd.d" (Vincent Bernat)
426 - [790752d0b5e7] interfaces: only use physical interfaces to get a chassis ID (Vincent Bernat)
427 - [8e9bf5cd846b] debian: ship files in debian/etc/lldpd.d (Vincent Bernat)
428 - [79790b96b5eb] build: check if pkg-config is correctly installed in ./autogen.sh (Vincent Bernat)
429 - [17cd6a2ec9ed] build: check for needed commands in autogen.sh (Vincent Bernat)
430 - [a9f774888552] build: provide a sysusers.d file (Vincent Bernat)
431 - [dbfa89c6e597] lldpd: handle early cleanup in case interface cannot be created (Vincent Bernat)
432 - [8568f6cd2277] lib: handle read failure in sync case (Vincent Bernat)
433 - [e1556c13cceb] lib: really correctly handle read failure (Vincent Bernat)
434 - [2c4dda069401] lldpcli: disable SIGPIPE (Vincent Bernat)
435 - [62f2faac3c69] lib: correctly handle read failure (Vincent Bernat)
436 - [89a8419047d4] lib: stricter checks when resuming an operation in progress (Vincent Bernat)
437 - [797da1252a18] lldpcli: add editor local variables to bash completion (Vincent Bernat)
438 - [8bddf2143914] lldpcli: add editor local variables to zsh completion (Vincent Bernat)
439 - [8d641ab478fc] lldpcli: indent multiline texts (like system description) (Vincent Bernat)
440 - [320238c4de15] lldpcli: fix style convention to match other files (Vincent Bernat)
441 - [c2153fb65e21] bash/zsh: ensure completions are present in dist tarball (Vincent Bernat)
442 - [9bc3d50e21dc] NEWS: add a word about bash/zsh completion (Vincent Bernat)
443 - [0a735dedbdf7] zsh: add ZSH completion (Vincent Bernat)
444 - [2136d8066293] bash: move bash completion outside Debian packaging (Vincent Bernat)
445 - [3620ee09fa2f] release: new version 0.7.10 (Vincent Bernat)
446
447 0.7.10 [2014-07-21 18:06:54 +0200]:
448
449 - [87ebf13df38c] NEWS: add a word about json-c library support (Vincent Bernat)
450 - [5dcd280d1267] lldpcli: fix jansson implementation of the JSON output (Vincent Bernat)
451 - [71542b4ec734] configure: if --with-json, default to jansson implementation (Vincent Bernat)
452 - [368daef3d649] cdp: complete manual page with CDP-related options (Vincent Bernat)
453 - [611aba00053c] cdp: Make it possible to enable CDPv2 without enabling CDPv1 (Michel Stam)
454 - [5d8f75fe9fdc] lldpcli: Add json description to lldpcli usage (Michel Stam)
455 - [619c379964fd] cdp: Add power requirement to CDPv2 frames (Michel Stam)
456 - [8ff14a6d117e] lldpcli: Add support for JSON-C (Michel Stam)
457 - [62d6f99d2d17] lldpcli: make complete command work on privleged commands as well (Vincent Bernat)
458 - [314f382a5093] lldpcli: provide a hidden complete command for shell completion (Vincent Bernat)
459 - [e13945c02c44] lldpcli: change how privileged commands are declared (Vincent Bernat)
460 - [40df69956ad0] lldpcli: reformat a bit bash completion to be more readable (Vincent Bernat)
461 - [ecd41283aa58] priv: avoid a socket leak when interface is already in promisc (Vincent Bernat)
462 - [ba908c4eedaa] snmp: avoid deferencing a pointer when it may be NULL (Vincent Bernat)
463 - [5317a14a3f0e] dcbx tlv recd are printed as log_debug (Sam Tannous)
464 - [7efa65c16ec7] lldpcli: use protocol map from liblldpctl to select protocol (Vincent Bernat)
465 - [baaa96d1530c] lldpcli: document `-u` argument in synopsis (Vincent Bernat)
466 - [494264f0f831] lldpcli: add display filter to show nbrs running specific protocols (Sam Tannous)
467 - [e147917d5257] lib: update liblldpctl versioning (Vincent Bernat)
468 - [1fa64c11d337] Add call to process more messages from data already read. (Sam Tannous)
469 - [0469161dd554] Add error code to the multicast address add/delete failure msg (Sam Tannous)
470 - [4f670a1e8ace] Move interface update msg to debug level (Sam Tannous)
471 - [003620d3104b] Add ignore handler for SIGHUP in lldpcli (Sam Tannous)
472 - [aef05ae38c63] This patch adds bash completion for lldpcli. (Sam Tannous)
473 - [ea51049df882] snmp: use poll() to wait for AgentX socket to be ready (Vincent Bernat)
474 - [dc6436adb4db] snmp: preserve previous flags when making AgentX socket non-blocking (Vincent Bernat)
475 - [b93e39a16736] make agentx socket non-blocking (Sam Tannous)
476 - [ad21b578b215] Make "too many neighbors for port" msg appear less frequently (Sam Tannous)
477 - [aca48e4ba570] lldpd: Fix netlink notification group for address changes (Sam Tannous)
478 - [b0b8841b0b42] Increase event buffer (Sam Tannous)
479 - [e595efb4c177] log: info messages should be logged on syslog but not on first debug level (Vincent Bernat)
480 - [254e5134d933] lldpd: fix log_info (Sam Tannous)
481 - [5e23c6b99bd3] NEWS: credit seccomp fix (Vincent Bernat)
482 - [d64549384f6f] lldpd: fix use of NULL in execl* (Vincent Bernat)
483 - [d769cdb235cc] Merge pull request #70 from chutz/seccomp-whitelist (Vincent Bernat)
484 - [285b33afd0da] lldpd: whitelist sendto, poll, recvmsg and readv in seccomp sandbox (Patrick McLean)
485 - [1059a20e7e2d] NEWS: add a word about ability to disable LLDP (Vincent Bernat)
486 - [b8a802bc7d8a] lldpd: fix how LLDP can be disabled (Vincent Bernat)
487 - [806eaef4832a] cdp: don't expect and off-by-one checksum (Vincent Bernat)
488 - [a5a60bbf97ed] frame: fix CDP checksum (udbxtd2008)
489 - [f4da5f84837c] README: document the new promisc interface in README as well (Vincent Bernat)
490 - [0a6f3866b830] lldpcli: give more details in the manual page about promiscuous mode (Vincent Bernat)
491 - [f84199ddf6c9] lldpcli: add an option to enable promisc mode on managed interfaces (Vincent Bernat)
492 - [ace524261458] priv: don't output rc status twice when unable to open socket (Vincent Bernat)
493 - [50724a52606f] README: more about Cisco sending LLDP frames on VLAN 1 (Vincent Bernat)
494 - [af5f56616c7f] osx: update version to 0.7.9 (Vincent Bernat)
495 - [02e51cb01a07] debian: sync a bit with official packaging (Vincent Bernat)
496 - [70943e342fff] version: prepare a new release (Vincent Bernat)
497 - [cf11ddf09817] lldpd: trigger regular interface refresh when changing port ID (Vincent Bernat)
498 - [bef085b8dbca] lldpcli: document `configure lldp portidsubtype` command (Vincent Bernat)
499 - [e82818d13e77] NEWS: mention ability to configure port ID (Vincent Bernat)
500 - [ff0a278f264a] lldpcli: fix a format warning (Vincent Bernat)
501 - [cf719ce84bf0] lldpcli: remove unused variable (Vincent Bernat)
502 - [8fbd31953957] Support for modifying PortID TLV (Sam Tannous)
503 - [ba66666322f9] README: point to the website for install instructions (Vincent Bernat)
504 - [f7f82e1e2a37] README: update the intro to better match the reality (Vincent Bernat)
505 - [fd7bb9f409e6] travis: don't use regular options when on coverity branch (Vincent Bernat)
506 - [cddf0a08236b] travis: don't do anything if not on the coverity branch (Vincent Bernat)
507 - [d82e81816b5e] travis: reduce matrix by not compiling everything with clang (Vincent Bernat)
508 - [b2c51a1d62be] travis: integrate coverity script in regular run.sh (Vincent Bernat)
509 - [78f816e9af24] travis: when running coverity, skip regular build (Vincent Bernat)
510 - [0db5b7bbffa6] travis: don't try to install launchd/systemd stuff (Vincent Bernat)
511 - [c034207574e1] travis: no need for `make install` (Vincent Bernat)
512 - [7b4eb1949a4b] bsd: ensure we also have space for the padding after BPF header (Vincent Bernat)
513 - [eeb66a08bdb7] bsd: ensure proper alignment of BPF header (Vincent Bernat)
514 - [986effcb7a97] bsd: ensure we also have space for the BPF header (Vincent Bernat)
515 - [3d596bbefdd9] bsd: fix clang warning about alignment problem with sockaddr (Vincent Bernat)
516 - [dd82040caf7d] travis: run "make distcheck" with the appropriate configure arguments (Vincent Bernat)
517 - [7e4a91f0481d] travis: only run "make distcheck" (Vincent Bernat)
518 - [047ab6702ded] travis: on OS X, try with/without embedded libevent and with/without SNMP (Vincent Bernat)
519 - [45bf176ba539] travis: try to build only with clang on OS X (Vincent Bernat)
520 - [54c78d4c61e2] travis: use devel version of net-snmp on OSX (Vincent Bernat)
521 - [98e2e4754996] travis: misc change to trigger a rebuild (Vincent Bernat)
522 - [622d14bbdf16] lldpcli: directive to configure IP management pattern (Vincent Bernat)
523 - [6afb24c220d8] lldp: fix handling of LLDPDU expiration (Vincent Bernat)
524 - [a85eea84bb3f] NEWS: mention support for shutdown LLDPDU (Vincent Bernat)
525 - [5a215d4b32cd] lldp: support for shutdown LLDPU (Vincent Bernat)
526 - [0e29d79487c5] interfaces: default to use of a local administered MAC address for bonds (Vincent Bernat)
527 - [d5f8351c8367] NEWS: mention the fix for local address use (Vincent Bernat)
528 - [8229c8ebd9ba] man: more documentation for bond-slave-src-mac-type (Vincent Bernat)
529 - [c6d4d3229fb8] interfaces: fallback to fixed MAC if already a local MAC (Vincent Bernat)
530 - [9173f75725a8] interfaces: fix use of locally administered use on bond devices (Vincent Bernat)
531 - [860c5567ba39] osx: use /var as a base for socket location (Vincent Bernat)
532 - [2cbc9cc56219] man: use configured path for /var/run/lldpd.socket (Vincent Bernat)
533 - [5133ce2fc2b9] configure: make default PID location configurable (Vincent Bernat)
534 - [3a3a36239b5d] configure: make default socket location configurable in configure (Vincent Bernat)
535 - [9a4ed64aabbb] configure: use `runstatedir` instead of /var/run in configure (Vincent Bernat)
536 - [08841844176c] configure: don't use fallback values in summary (Vincent Bernat)
537 - [cdcf7dc577a2] lldpcli: return success when reading commands from files (Vincent Bernat)
538 - [084988d49489] osx: update Homebrew formula to match what has been done in Homebrew (Vincent Bernat)
539 - [c6d3aa0f58f4] configure: enable use of colored output for gcc (Vincent Bernat)
540 - [8f109ee23771] configure: use -fstack-protector-strong if available (Vincent Bernat)
541 - [70f4df2aaa49] osx: new release (Vincent Bernat)
542 - [17a90fc0af9c] lldpcli: document new "configure system hostname" directive (Vincent Bernat)
543 - [412a1dadab09] version: prepare new release (Vincent Bernat)
544 - [724d71ea13ce] NEWS: add several items to the changelog (Vincent Bernat)
545 - [3dc1eb8ca263] configure: make some flags conditional (Vincent Bernat)
546 - [67d43beb0834] osx: blacklist p2pX interfaces (Vincent Bernat)
547 - [29760896f54e] configure: hide errors when systemd is not present (Vincent Bernat)
548 - [6579462d82d4] compat: fix vsyslog to rely on the result of vasprintf (Vincent Bernat)
549 - [f31ac893ad90] compat: include stdarg to get va_list (Vincent Bernat)
550 - [dbc971443826] compat: fix use of vasprintf (previously _vasprintf) (Vincent Bernat)
551 - [3522094f0d24] lldpcli: use a previously unused variable (Vincent Bernat)
552 - [984bbcbc1126] lldpd: add a note about command-line options (Vincent Bernat)
553 - [f88a0f1f8209] Merge pull request #60 from jonasj76/override-hostname (Vincent Bernat)
554 - [dfa181af0730] lldpd: Remove the '-N' command-line flag (Jonas Johansson)
555 - [ce347d296c89] lldp: add option/command to override hostname (Jonas Johansson)
556 - [87dfd17553de] coverity: change a bit the annotations (Vincent Bernat)
557 - [b64a011bf4e4] coverity: fix a false positive in SNMP transport (Vincent Bernat)
558 - [79dae0f0d8fb] coverity: fix memory leak in lldpd when the same option is repeated (Vincent Bernat)
559 - [af35cabd68c6] coverity: fix memory leak in lldpcli (Vincent Bernat)
560 - [d0b88676ed80] redhat: enable SNMP support on RHEL 5 and CentOS 5 by default (Vincent Bernat)
561 - [ae7f4c2945f0] snmp: link with Net-SNMP later (Vincent Bernat)
562 - [bd3da7c52879] priv: use AF_UNIX for socketpair() (Vincent Bernat)
563 - [1a3dd5a8e028] configure: _XOPEN_SOURCE=500 to be like _GNU_SOURCE=1 (Vincent Bernat)
564 - [554d650db8dc] hpux: provide a replacement for daemon() for HP-UX (Vincent Bernat)
565 - [9f497e04a0a8] hpux: provide a replacement for vsyslog() for HP-UX (Vincent Bernat)
566 - [da0a34dd6ba6] asprintf: we are also using vasprintf, let's define it correctly (Vincent Bernat)
567 - [24b8d79f8895] build: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere (Vincent Bernat)
568 - [9fe83ec06914] bsd: check of SIOCGIFDESCR instead of IFDESCRSIZE (Vincent Bernat)
569 - [f41ed9c5bd31] privsep: don't use err.h: not needed (Vincent Bernat)
570 - [6a5334d4d523] asprintf: fix warnings in SNMP tests related to asprintf (Vincent Bernat)
571 - [0921a7f4ce4a] asprintf: do not redeclare on SNMP tests (Vincent Bernat)
572 - [46673df2cbbe] asprintf: globally define _GNU_SOURCE (Vincent Bernat)
573 - [39f940da4592] debian: fix postinst to create _lldpd user (Vincent Bernat)
574 - [64ee56f83848] debian: same style for postinst and postrm (Vincent Bernat)
575 - [b345311cbb8f] lib: use strlcpy() instead of strcpy() (Vincent Bernat)
576 - [c6aa43e5b86d] interfaces: convert a whitelisted interface to a physical one (Vincent Bernat)
577 - [627e31c489e6] interfaces: circumvent any physical check on exact match (Vincent Bernat)
578 - [8b53fc2c2ad5] interfaces: allow whitelisting an interface (Vincent Bernat)
579 - [d5e69431014a] interfaces: document and test pattern matching (Vincent Bernat)
580 - [3ff9f162a184] build: use -fno-omit-frame-pointer for ease of debug (Vincent Bernat)
581 - [27faad4fd793] lib: don't use strlcpy() when strcpy() just works (Vincent Bernat)
582 - [dcf5d2f72dc9] build: remove duplicate const declaration (Vincent Bernat)
583 - [ed9e6f414305] travis: put installation and test instructions into shell scripts (Vincent Bernat)
584 - [81c693e642a4] travis: test with OSX and clang (Vincent Bernat)
585 - [971d12ce529b] build: on OSX, use glibtoolize by default (Vincent Bernat)
586 - [02987888adc8] lldpcli: fix readline() wrapper to take prompt as argument (Vincent Bernat)
587 - [fe8f9650079c] lldpcli: check for privileges by checking access to control socket (Vincent Bernat)
588 - [91f424d16491] lldpcli: root is privileged (Vincent Bernat)
589 - [cc160b887858] interfaces: reset router and wlan capability bits (Vincent Bernat)
590 - [6b0954714065] lldpd: enable "stationOnly" capability if we don't have anything else (Vincent Bernat)
591 - [0c1589a2fea8] lib: add URL in lldpctl.pc (Vincent Bernat)
592 - [edc0cc14a8c4] lib: fix includedir in lldpctl.pc (Vincent Bernat)
593 - [69abf8b2b37c] fgetln: provide a version not relying on getline() (Vincent Bernat)
594 - [31594635ecc1] daemon: unset UPSTART_JOB and NOTIFY_SOCKET once used (Vincent Bernat)
595 - [45bf0bd0627d] lldpd: use vfork+exec instead of fork+exec (Vincent Bernat)
596 - [16bbd290d5d7] priv: add compilation without privilege separation to Travis (Vincent Bernat)
597 - [71a7dbb3c64d] priv: add the ability to disable privilege separation (Vincent Bernat)
598 - [d2a289bba82f] privsep: IO should specify the context (Vincent Bernat)
599 - [8b0ca98ef399] README: add build instructions for Android (Vincent Bernat)
600 - [69a7ffa0bac8] include: don't ship `linux/socket.h` (Vincent Bernat)
601 - [afe3dabf9eed] priv: declare `res_init()` for builds against Android's Bionic (Vincent Bernat)
602 - [608b5669ebf1] lldpcli: replace safe use of `strcpy` by `strlcpy` (Vincent Bernat)
603 - [0fd9e6e25bfb] build: hide generation of syscall-names.h (Vincent Bernat)
604 - [7ee3d13d3637] cdp: fix regression in CDP packet building (Vincent Bernat)
605 - [12313820fafc] lldp: don't hard-code sysname, sysdescr and portdescr (Vincent Bernat)
606 - [912dfcff033b] interfaces: remove useless return (Vincent Bernat)
607 - [d79850426254] lldp: do not send system description TLV if empty (Vincent Bernat)
608 - [493b0d427fb4] configure: provide GitHub address for issues (Vincent Bernat)
609 - [ed409ccd3ef8] clang: use ETHER_ADDR_LEN instead of sizeof() (Vincent Bernat)
610 - [dd1d33cf7c97] marshal: use __alignof__ operator if available (Vincent Bernat)
611 - [e4dea55d69be] clang: fix an obvious use after free (Vincent Bernat)
612 - [6f4b6d5872c3] alignof: handle sizeof(t) == 1 case (Vincent Bernat)
613 - [d68f1b813cf8] coverity: really fix popt issue (Vincent Bernat)
614 - [46a5f939b66d] coverity: add code annotation to remove false positives (Vincent Bernat)
615 - [26667615414c] coverity: if we cannot read /etc/localtime, don't go further (Vincent Bernat)
616 - [8ad3bafab619] coverity: don't fallback to next case for clarity (Vincent Bernat)
617 - [e2b09091a263] coverity: replace unsafe uses of strncpy by strlcpy (Vincent Bernat)
618 - [cdece23a6df4] coverity: remove always false comparison (Vincent Bernat)
619 - [39d78d567ddf] coverity: remove dead code (Vincent Bernat)
620 - [037d4c8ea40e] coverity: don't make `-L` flag switch off version advertisement (Vincent Bernat)
621 - [3332985ad598] coverity: handle case where we didn't get enough place in getopt string (Vincent Bernat)
622 - [ddd75166dd41] coverity: remove a theoritical memory leak (Vincent Bernat)
623 - [4032084d12c4] coverity: fix a memory leak (Vincent Bernat)
624 - [3ee3f25d9ad2] coverity: fix a resource leak (Vincent Bernat)
625 - [b7e2b07c1eb6] coverity: fix TOCTOU problem when creating chroot (Vincent Bernat)
626 - [0059e4786dc8] coverity: remove dead code (Vincent Bernat)
627 - [a56f413747cf] coverity: remove unused pointer value (Vincent Bernat)
628 - [6df40257e2c1] gitignore: add GNU global files (Vincent Bernat)
629 - [872caaf9e779] debian: fix debian/lldpd.install to use provided lldpd.service (Vincent Bernat)
630 - [82e23221f46a] redhat: don't try to install systemd stuff (Vincent Bernat)
631 - [a28d7016c92e] redhat: fix version in lldpd.spec (Vincent Bernat)
632 - [e4e5a1f8efc2] osx: update homebrew recipe (Vincent Bernat)
633 - [d72c2c591fb6] release: prepare for release of 0.7.7 (Vincent Bernat)
634 - [3a9dc9c133f5] lldpd: tell `lldpcli` to use the appropriate control socket (Vincent Bernat)
635 - [f7242beb1ef8] lldpcli: accepts `-u` option to specify control socket (Vincent Bernat)
636 - [b6312220edf5] privsep: put /etc/localtime in chroot (Vincent Bernat)
637 - [4006b64e3a92] systemd: also read /etc/sysconfig/lldpd (Vincent Bernat)
638 - [ff4d7fa9c7ef] systemd: require mount points to have chroot possible (Vincent Bernat)
639 - [25f47deab82c] systemd: starts lldpd after network (Vincent Bernat)
640 - [c2e68bff3dda] tests: only test if we have `check` installed (Vincent Bernat)
641 - [246701fe22bd] seccomp: do not ship `syscall-names.h` (Vincent Bernat)
642 - [6a427fb18c67] travis: don't limit tests to master branch. (Vincent Bernat)
643 - [4e97a0bf8488] lib: fix a segfault introduced in ef3707 when freeing an atom (Vincent Bernat)
644 - [00e40dba232c] seccomp: add support for seccomp through libseccomp (Vincent Bernat)
645 - [bde52887c7f4] systemd: use full path for mkdir/cp (Vincent Bernat)
646 - [140e34f05746] systemtap: provide an appropriate tapset (Vincent Bernat)
647 - [bdfe41938907] dtrace: add systemtap/DTrace support (Vincent Bernat)
648 - [5f7d1cd51fe9] README: explain how to handle VLAN-encapsulated LLDP frames (Vincent Bernat)
649 - [f17837f781b0] configure: use a convenience library for fixed point arithmetic (Vincent Bernat)
650 - [c0cdd0111f3f] Revert "README: remove inexact paragraph about stacking bonding/vlans/bridges" (Vincent Bernat)
651 - [12baf7811f63] linux: fix a regression in how enslaved devices' MAC addresses are retrieved (Vincent Bernat)
652 - [dbcb684662e2] event: don't call `netsnmp_check_outstanding_agent_requests()` (Vincent Bernat)
653 - [9a4e257b0ad1] priv: use unistd.h to get `close()` (Vincent Bernat)
654 - [4565704cef06] configure: remove an extra parenthesis in args.m4 (Vincent Bernat)
655 - [4dfe31fd72ad] systemd: install service file using `systemdsystemunit_DATA` (Vincent Bernat)
656 - [bdc954b77ada] lib: fix notification by reading one byte at a time from Unix socket (Vincent Bernat)
657 - [9d1524b7de1c] systemd: ship lldpd.service file if possible (Vincent Bernat)
658 - [41e57d5a8821] lldpd: fix a segfault when a port disappear (Vincent Bernat)
659 - [42ea638d61b5] lldpd: small optimization in the expiration process (Vincent Bernat)
660 - [ef3707dacfd9] lldpd: make notifications work when a port goes down (Vincent Bernat)
661 - [f5a0a15ea37d] linux: add support for team devices (Vincent Bernat)
662 - [5813918ade1b] rpc: don't check source MAC settings when it is 0 (Vincent Bernat)
663 - [7d758eec2bf7] interfaces: mangle source MAC address on bonds for other OS too (Vincent Bernat)
664 - [5347914ef1fc] interfaces: abstract a bit MAC address mangling for bonding devices (Vincent Bernat)
665 - [99704cd9b9ff] interfaces: move "mangle" function for bond slaves (Vincent Bernat)
666 - [bae18e13c284] lldpcli: remove unused variable (Vincent Bernat)
667 - [d7166588be78] lib: update version-info to match previous changes (Vincent Bernat)
668 - [2746d430fbcc] bond: reenable the possibility to use a fixed MAC address (Vincent Bernat)
669 - [c9703b9640ac] client: move register of bond-slave-src-mac-type to a separate function (Vincent Bernat)
670 - [dfbd7185f823] [PATCH| lldpd: use bond slave real mac with locally administered bit set as sour ce man in lldp frames sent on bond slaves (Roopa Prabhu)
671 - [87bc6683c602] linux: mangle MAC address for enslaved devices (Vincent Bernat)
672 - [96f2411a2bbf] lib: fix parsing of "11542." (Vincent Bernat)
673 - [f730f6c5f648] lib: introduce proper fixed point parsing and representation module (Vincent Bernat)
674 - [d2c04230fb3a] lib: correctly set altitude unit without erasing neighbouring data (Vincent Bernat)
675 - [bec75f842fa4] event: replace `evutil_make_socket_nonblocking()` by an idempotent version (Vincent Bernat)
676 - [1e0d651f6ec9] lldpd: invoke `setproctitle_init()` when needed (Vincent Bernat)
677 - [5c4fa9bdc202] priv: use `sigaction()` instead of `signal()` to install non-default signals (Vincent Bernat)
678 - [82fcdf156dd2] README: on OSX, /etc is a symlink to /private/etc. (Vincent Bernat)
679 - [c3f855602d84] osx: make the path to /Library/LaunchDaemons configurable (Vincent Bernat)
680 - [352897291cc5] osx: minimize differences with downstream Homebrew formula (Vincent Bernat)
681 - [6ed2b9ad9b4f] osx: fix a syntax error in Homebrew formula (Vincent Bernat)
682 - [91a63c540e59] osx: patch the installation of launchd plist file for Homebrew (Vincent Bernat)
683 - [53c56a7a0fef] osx: don't remove the whole /Library/LaunchDaemons directory on uninstall! (Vincent Bernat)
684 - [d0a033727caa] configure: check for `res_init()` before trying other forms. (Vincent Bernat)
685 - [ba09084d4764] README: remove inexact paragraph about stacking bonding/vlans/bridges (Vincent Bernat)
686 - [25354cf35113] osx: update SHA1 sum for Homebrew recipe (Vincent Bernat)
687 - [09587df0ed71] osx: fix postinstall script (Vincent Bernat)
688 - [3336988a6ccd] packaging: change `PreReq` to `Requires(pre)` in lldpd.spec (Vincent Bernat)
689 - [03b0a19012f9] packaging: update to 0.7.6 (Vincent Bernat)
690 - [22f1ea467ef9] README: show how to use tcpdump for troubleshooting (Vincent Bernat)
691 - [065732ca3413] priv: correctly declare `priv_cmd` type (Vincent Bernat)
692 - [bcde9c0aa535] doc: add a CONTRIBUTE document (Vincent Bernat)
693 - [fef34dede19b] linux: define IFALIASZ for old systems (Vincent Bernat)
694 - [3a723384557d] lldpd: fix a fd leak when we cannot write the new alias (Vincent Bernat)
695 - [015ecdd5f6ac] lldpd: append "was" to an interface description when a neighbor disappear (Vincent Bernat)
696 - [bb37268d812b] client: add "configure/unconfigure system interface description" command (Vincent Bernat)
697 - [2de09499f87f] lib: `lldpctl_k_config_receiveonly` is a read-only property (Vincent Bernat)
698 - [47820fc416cc] interfaces: overwrite interface description with neighbor found (Vincent Bernat)
699 - [53d4577a63fd] priv: avoid to leak generic socket (Vincent Bernat)
700 - [4ea0565ebd7c] privsep: separate OS specific code to dedicated files (Vincent Bernat)
701 - [784077f8b096] redhat: require groupadd/useradd (Vincent Bernat)
702 - [31e4e7c6205f] osx: don't repeat `pkg-ref` several times in `distribution.xml` (Vincent Bernat)
703 - [4c4e1aef7a51] osx: don't use `domains` tag in `distribution.xml` (Vincent Bernat)
704 - [462d8b6c813a] osx: add a way to compile for older versions of OS X (Vincent Bernat)
705 - [fa71a00c8b1a] osx: `make pkg` can now build universal binaries (Vincent Bernat)
706 - [5b90c4f5c054] osx: don't try to build universal binaries (Vincent Bernat)
707 - [42494121e890] configure: remove out-dated instructions to regen autoconf out-of-git (Vincent Bernat)
708 - [5e36732de776] snmp: fix a typo in `agent_priv.c` (Vincent Bernat)
709 - [e9f4d63c9efa] configure: ensure that osx/scripts are executable (Vincent Bernat)
710 - [7298e28fad13] osx: use HTML files instead of RTF for welcome message (Vincent Bernat)
711 - [92f5db08c399] osx: simpler instructions in README.md (Vincent Bernat)
712 - [b708297cbab9] osx: add a target to build an OSX package (Vincent Bernat)
713 - [abacd8d20f8c] configure: fix a typo in the description of `--with-embedded-libevent` option (Vincent Bernat)
714 - [e37255a58218] travis: check that we can build lldpd with embedded libevent (Vincent Bernat)
715 - [f829effd3fe8] configure: add a flag to force use of embedded libevent (Vincent Bernat)
716 - [eea17f742927] debian: update packaging to match downstream (Vincent Bernat)
717 - [edc437d94f56] compat: include config.h in compat.h (Vincent Bernat)
718 - [28178982aa65] compat: fix strndup (Vincent Bernat)
719 - [2523da3af610] NEWS: add an entry about the use of `strndup()` (Vincent Bernat)
720 - [7354ec8f2bd0] compat: add `strndup()` compatibility function (Vincent Bernat)
721 - [d52cf1d2729f] compat: remove copyright notice for setproctitle() (Vincent Bernat)
722 - [c6540ece3ea7] tests: define ck_assert_ptr_eq if check is too old (Vincent Bernat)
723 - [46a402c55b96] osx: use SHA1 instead of MD5 in homebrew formula (Vincent Bernat)
724 - [1e8952da6db7] check: use `ck_assert_ptr_eq` instead of `ck_assert_int_eq`. (Vincent Bernat)
725 - [b0cb07f7ed0b] style: use C99 designated initializers instead of memset() when possible (Vincent Bernat)
726 - [444c6862d096] packaging: update to 0.7.5 (Vincent Bernat)
727 - [2169efb24f0a] tokenizer: input buffer was too small (Vincent Bernat)
728 - [6712d3ec1409] packaging: update packaging (Vincent Bernat)
729 - [138121782171] bpf: on OpenBSD, invert the filter direction (Vincent Bernat)
730 - [96b97fac65bb] NEWS: add an entry for the use of `setproctitle()` (Vincent Bernat)
731 - [f0d215766ac0] compat: declare `setproctitle()` as a printf function (Vincent Bernat)
732 - [19ce8130c7f1] debian: build-depends on libbssd-dev (Vincent Bernat)
733 - [e7103aff39e2] lldpd: when no `setproctitle()` available, don't count neighbors (Vincent Bernat)
734 - [480f1c6130ef] lldpd: count number of chassis to get number of neighbors (Vincent Bernat)
735 - [25eb1871461a] lldpd: don't call `lldpd_count_neighbors()` too many times (Vincent Bernat)
736 - [66879d46ac2b] build: use libbsd if available, also use `setproctitle()` (Vincent Bernat)
737 - [3f70e1182aeb] lldpcli: `configure system platform` to override platform description (Vincent Bernat)
738 - [decaec0d8a67] lldpcli: `configure system description` to override chassis description (Vincent Bernat)
739 - [994b3371b3b0] lldpcli: split `conf.c` into `conf-system.c` and `conf-lldp.c`. (Vincent Bernat)
740 - [48d0a4b0d72e] lldpcli: `configure system interface pattern` instead of `configure lldp iface-pattern` (Vincent Bernat)
741 - [a3e0896768d4] libevent: use GitHub git tree (Vincent Bernat)
742 - [c11e397a7598] debian: sync packaging with official Debian package (Vincent Bernat)
743 - [e39f079a1558] libevent: switch to patches-2.0 branch to get the appropriate automake fix (Vincent Bernat)
744 - [8677ddc78172] git: ignore test-driver, generated by recent automake versions (Vincent Bernat)
745 - [bea0d76429a2] Fixed some boundary conditions in code that cleans remote ports on ttl expiry. (Roopa Prabhu)
746 - [5aeda65433fd] liblldpctl: fix infinite loop when user is reading fixed chunks (Pradosh Mohapatra)
747 - [d82342940c39] marshal: fix alignment issue when unserializing (Vincent Bernat)
748 - [bea703140788] log: fix memory leak when using a log handler (Vincent Bernat)
749 - [a8da18644b17] marshal: don't declare serialize/unserialize helper for string (Vincent Bernat)
750 - [02cf0357c916] lldpd: fix an alignment (non-)issue (Vincent Bernat)
751 - [bd8a8861df79] lldpcli: don't use an hack to pass the writer to watch callback (Vincent Bernat)
752 - [985a4cb5f210] marshal: provide type-specific serialization/unserialization functions (Vincent Bernat)
753 - [aba549a82a0f] client: fix a memory leak when changing lldpd configuration (Vincent Bernat)
754 - [93afd294af9b] ctl: fix a memory leak when cleaning control socket (Vincent Bernat)
755 - [e681c859c6c9] client: trigger interface refresh when updating interface pattern (Vincent Bernat)
756 - [e26a25ca4d0e] lib: fix a memory leak when modifying interface pattern (Vincent Bernat)
757 - [0093777b2894] lldpcli: document "configure lldp iface-pattern" in manual page (Vincent Bernat)
758 - [7e516f104a85] lldpctl.h: document possibility to write iface-pattern (Vincent Bernat)
759 - [346a0f6961ba] lldpcli: Add support to set iface-pattern (roopa)
760 - [0728cb8205f7] sonmp: allow SONMP unittests to work without a global config (Vincent Bernat)
761 - [ea481e370199] man: document tx-hold (Vincent Bernat)
762 - [cb5f7399a79f] man: tx-interval cannot be set per port (Vincent Bernat)
763 - [c10302a38ece] lldpd: Add tx_hold (roopa)
764 - [5920dbf73ae1] lldpcli: don't rely on `fgetln()` providing a NULL-terminated string (Vincent Bernat)
765 - [655145c07b89] lldpcli: don't free input line (Vincent Bernat)
766 - [d1dc456f990f] lib: keep space for new values in `lldpctl_key_t` (Vincent Bernat)
767 - [40116b407603] debian: synchronize packaging with Debian (Vincent Bernat)
768 - [e91ca9d0157c] release: prepare 0.7.3 (Vincent Bernat)
769 - [a1728b7df077] NEWS: add a word about Solaris support (Vincent Bernat)
770 - [b1a8985da685] solaris: less intrusive way to get CMSG_* macros (Vincent Bernat)
771 - [815b799b44ed] solaris: assume that IP forwarding is disabled (Vincent Bernat)
772 - [c3e340b6be8a] solaris: preliminary support (Vincent Bernat)
773 - [d0787f4e65c4] NEWS: add an entry about LLDP-MED fast start. (Vincent Bernat)
774 - [486a61330146] lldpcli: allow to enable/disable fast-start and set delay (Vincent Bernat)
775 - [d6d42d56f7eb] lldpd: enable fast start by default (Vincent Bernat)
776 - [be511d00bf41] lldpd: make fast start work only when receiving LLDP-MED LLDPDU (Vincent Bernat)
777 - [b9de0ca613f3] lldpd: fast start support (roopa)
778 - [7ba4a1832e43] configure: use `AC_PROG_EGREP` to find a suitable `grep -E` (Vincent Bernat)
779 - [ae5cae025029] lib: use uint8_t instead of u_int8_t (Vincent Bernat)
780 - [91e0280a7e7d] configure: display configured OS (Vincent Bernat)
781 - [885aa4f4aaba] lldpcli: complete the manual page with the syntax of "show statistics" (Vincent Bernat)
782 - [d947819daaaa] lldpcli: summary of statistics is done on provided ports only (Vincent Bernat)
783 - [048ed9db7ddf] lldpcli: fix two warnings introduced by the previous commit (Vincent Bernat)
784 - [adcb76f83ac9] NEWS: add an entry for "show statistics summary" command (Vincent Bernat)
785 - [5331eb2d47f0] lldpcli: global stats command (roopa)
786 - [1b3eea3d9025] os: add support for DragonFly BSD (Vincent Bernat)
787 - [de461f15d788] netlink: fix IP address discovery (Vincent Bernat)
788 - [3fc1a10a030f] lldpcli: fix typo in the man page for setting altitude (Vincent Bernat)
789 - [45a83f305d67] bsd: don't report a warning when no media information is present (Vincent Bernat)
790535 - [03ee074db6ca] build: both client and lib may need shipped headers in include/ (Vincent Bernat)
791536 - [4c758e896ded] fgetln: getline may need _GNU_SOURCE (Vincent Bernat)
792537 - [bed9f656dc3a] install: install ChangeLog (Vincent Bernat)
1313 ChangeLog: __force-changelog-generation
1414 $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \
1515 prev=$$(git describe --tags --always --match '[0-9]*' 2> /dev/null) ; \
16 for tag in $$(git tag | $(EGREP) '^[0-9]+(\.[0-9]+){1,}$$' | sort -rn); do \
16 for tag in $$(git tag | $(EGREP) '^[0-9]+(\.[0-9]+){1,}$$' | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr); do \
1717 if [ x"$$prev" = x ]; then prev=$$tag ; fi ; \
1818 if [ x"$$prev" = x"$$tag" ]; then continue; fi ; \
1919 echo "$$prev [$$(git log $$prev -1 --pretty=format:'%ai')]:" ; \
342342 LIPO = @LIPO@
343343 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
344344 LLDPD_PID_FILE = @LLDPD_PID_FILE@
345 LLDP_CFLAGS = @LLDP_CFLAGS@
346 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
347 LLDP_LDFLAGS = @LLDP_LDFLAGS@
345348 LN_S = @LN_S@
346349 LTLIBOBJS = @LTLIBOBJS@
347350 MAINT = @MAINT@
428431 mkdir_p = @mkdir_p@
429432 oldincludedir = @oldincludedir@
430433 pdfdir = @pdfdir@
434 pkgconfigdir = @pkgconfigdir@
431435 prefix = @prefix@
432436 program_transform_name = @program_transform_name@
433437 psdir = @psdir@
10671071 ChangeLog: __force-changelog-generation
10681072 $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \
10691073 prev=$$(git describe --tags --always --match '[0-9]*' 2> /dev/null) ; \
1070 for tag in $$(git tag | $(EGREP) '^[0-9]+(\.[0-9]+){1,}$$' | sort -rn); do \
1074 for tag in $$(git tag | $(EGREP) '^[0-9]+(\.[0-9]+){1,}$$' | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr); do \
10711075 if [ x"$$prev" = x ]; then prev=$$tag ; fi ; \
10721076 if [ x"$$prev" = x"$$tag" ]; then continue; fi ; \
10731077 echo "$$prev [$$(git log $$prev -1 --pretty=format:'%ai')]:" ; \
0 lldpd (0.7.14)
1 * Features:
2 + Shutdown LLPDU are sent on MSAP change and when lldpd exits.
3 + When an exact IP is provided as a management pattern, use it
4 unconditionally.
5 + Ability to set port ID and description to an arbitrary value,
6 thanks to Alexandru Ardelean.
7 * Fix:
8 + Incorrect boundary check when decoding management address and
9 protocol identity may lead to lldpd crash when processing
10 malformed LLDPDU.
11 + Many edge cases where lldpd was leaving hanging processes after
12 crashing.
13
14 lldpd (0.7.13)
15 * Fix:
16 + Unbreak customization of Unix socket path from command line.
17
18 lldpd (0.7.12)
19 * Features:
20 + Interface pattern, management pattern, system description,
21 system platform and system hostname can be unconfigured to their
22 default values.
23 * Fix:
24 + Don't complain when parsing a commented line.
25 + Correctly persist configuration changes for "system interface
26 promiscuous", "system interface description" "med fast-start
27 enable", "pause" and "resume".
28 + Fix listening on bond devices for old kernels (< 2.6.27).
29
030 lldpd (0.7.11)
131 * Features:
232 + Ship bash and zsh completion.
377377 # configured tree to be moved without reconfiguration.
378378
379379 AC_DEFUN([AM_AUX_DIR_EXPAND],
380 [dnl Rely on autoconf to set up CDPATH properly.
381 AC_PREREQ([2.50])dnl
382 # expand $ac_aux_dir to an absolute path
383 am_aux_dir=`cd $ac_aux_dir && pwd`
380 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
381 # Expand $ac_aux_dir to an absolute path.
382 am_aux_dir=`cd "$ac_aux_dir" && pwd`
384383 ])
385384
386385 # AM_CONDITIONAL -*- Autoconf -*-
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for lldpd 0.7.11.
2 # Generated by GNU Autoconf 2.69 for lldpd 0.7.14.
33 #
44 # Report bugs to <https://github.com/vincentbernat/lldpd/issues>.
55 #
589589 # Identity of this package.
590590 PACKAGE_NAME='lldpd'
591591 PACKAGE_TARNAME='lldpd'
592 PACKAGE_VERSION='0.7.11'
593 PACKAGE_STRING='lldpd 0.7.11'
592 PACKAGE_VERSION='0.7.14'
593 PACKAGE_STRING='lldpd 0.7.14'
594594 PACKAGE_BUGREPORT='https://github.com/vincentbernat/lldpd/issues'
595595 PACKAGE_URL='http://vincentbernat.github.io/lldpd/'
596596
650650 USE_SNMP_TRUE
651651 HAVE_CHECK_FALSE
652652 HAVE_CHECK_TRUE
653 LLDP_LDFLAGS
654 LLDP_CPPFLAGS
655 LLDP_CFLAGS
653656 LLDPD_PID_FILE
654657 LLDPD_CTL_SOCKET
655658 PRIVSEP_CHROOT
684687 NETSNMP_LIBS
685688 NETSNMP_CONFIG
686689 READLINE_LIBS
690 pkgconfigdir
687691 LIBEVENT_LDFLAGS
688692 LIBEVENT_EMBEDDED_FALSE
689693 LIBEVENT_EMBEDDED_TRUE
903907 enable_doxygen_ps
904908 enable_doxygen_pdf
905909 with_embedded_libevent
910 with_pkgconfigdir
906911 with_readline
907912 with_snmp
908913 with_xml
14961501 # Omit some internal or obsolete options to make the list less imposing.
14971502 # This message is too long to be a string in the A/UX 3.1 sh.
14981503 cat <<_ACEOF
1499 \`configure' configures lldpd 0.7.11 to adapt to many kinds of systems.
1504 \`configure' configures lldpd 0.7.14 to adapt to many kinds of systems.
15001505
15011506 Usage: $0 [OPTION]... [VAR=VALUE]...
15021507
15661571
15671572 if test -n "$ac_init_help"; then
15681573 case $ac_init_help in
1569 short | recursive ) echo "Configuration of lldpd 0.7.11:";;
1574 short | recursive ) echo "Configuration of lldpd 0.7.14:";;
15701575 esac
15711576 cat <<\_ACEOF
15721577
16221627 (or the compiler's sysroot if not specified).
16231628 --with-embedded-libevent
16241629 Force the use of embedded libevent [default=no]
1630 --with-pkgconfigdir pkg-config installation directory
1631 ['${libdir}/pkgconfig']
16251632 --with-readline Enable the use of readline-like library
16261633 [default=check]
16271634 --with-snmp Enable the use of SNMP [default=no]
17571764 test -n "$ac_init_help" && exit $ac_status
17581765 if $ac_init_version; then
17591766 cat <<\_ACEOF
1760 lldpd configure 0.7.11
1767 lldpd configure 0.7.14
17611768 generated by GNU Autoconf 2.69
17621769
17631770 Copyright (C) 2012 Free Software Foundation, Inc.
23582365 This file contains any messages produced by compilers while
23592366 running configure, to aid debugging if configure makes a mistake.
23602367
2361 It was created by lldpd $as_me 0.7.11, which was
2368 It was created by lldpd $as_me 0.7.14, which was
23622369 generated by GNU Autoconf 2.69. Invocation command line was
23632370
23642371 $ $0 $@
29182925 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
29192926 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
29202927
2921 # expand $ac_aux_dir to an absolute path
2922 am_aux_dir=`cd $ac_aux_dir && pwd`
2928 # Expand $ac_aux_dir to an absolute path.
2929 am_aux_dir=`cd "$ac_aux_dir" && pwd`
29232930
29242931 if test x"${MISSING+set}" != xset; then
29252932 case $am_aux_dir in
32323239
32333240 # Define the identity of the package.
32343241 PACKAGE='lldpd'
3235 VERSION='0.7.11'
3242 VERSION='0.7.14'
32363243
32373244
32383245 cat >>confdefs.h <<_ACEOF
1310713114 fi
1310813115
1310913116
13117 if test x"$ac_cv_prog_cc_c99" = x"no"; then
13118 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
13119 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
13120 as_fn_error $? "*** C99 support is mandatory
13121 See \`config.log' for more details" "$LINENO" 5; }
13122 fi
1311013123 ac_ext=cpp
1311113124 ac_cpp='$CXXCPP $CPPFLAGS'
1311213125 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1955219565 ;;
1955319566 esac
1955419567
19555 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D_FORTIFY_SOURCE=2" >&5
19556 $as_echo_n "checking CFLAGS for gcc -D_FORTIFY_SOURCE=2... " >&6; }
19568 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D_FORTIFY_SOURCE=2" >&5
19569 $as_echo_n "checking CPPFLAGS for gcc -D_FORTIFY_SOURCE=2... " >&6; }
1955719570 if ${ac_cv_cflags_gcc_option__D_FORTIFY_SOURCE_2+:} false; then :
1955819571 $as_echo_n "(cached) " >&6
1955919572 else
1960019613 .ok|.ok,*) ;;
1960119614 .|.no|.no,*) ;;
1960219615 *)
19603 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
19604 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
19605 (: CFLAGS does contain ${ac_res}) 2>&5
19616 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
19617 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
19618 (: CPPFLAGS does contain ${ac_res}) 2>&5
1960619619 ac_status=$?
1960719620 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1960819621 test $ac_status = 0; }
19609 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
19610 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
19622 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
19623 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
1961119624 ac_status=$?
1961219625 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1961319626 test $ac_status = 0; }
19614 CFLAGS="$CFLAGS ${ac_res}"
19627 CPPFLAGS="$CPPFLAGS ${ac_res}"
1961519628 fi
1961619629 ;;
1961719630 esac
2008320096
2008420097
2008520098 # Most of what we want can be enabled nowadays with _GNU_SOURCE
20086 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D_GNU_SOURCE" >&5
20087 $as_echo_n "checking CFLAGS for gcc -D_GNU_SOURCE... " >&6; }
20099 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D_GNU_SOURCE" >&5
20100 $as_echo_n "checking CPPFLAGS for gcc -D_GNU_SOURCE... " >&6; }
2008820101 if ${ac_cv_cflags_gcc_option__D_GNU_SOURCE+:} false; then :
2008920102 $as_echo_n "(cached) " >&6
2009020103 else
2013120144 .ok|.ok,*) ;;
2013220145 .|.no|.no,*) ;;
2013320146 *)
20134 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20135 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
20136 (: CFLAGS does contain ${ac_res}) 2>&5
20147 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20148 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
20149 (: CPPFLAGS does contain ${ac_res}) 2>&5
2013720150 ac_status=$?
2013820151 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2013920152 test $ac_status = 0; }
20140 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
20141 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
20153 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
20154 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
2014220155 ac_status=$?
2014320156 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2014420157 test $ac_status = 0; }
20145 CFLAGS="$CFLAGS ${ac_res}"
20158 CPPFLAGS="$CPPFLAGS ${ac_res}"
2014620159 fi
2014720160 ;;
2014820161 esac
2014920162
2015020163 case $host_os in
2015120164 solaris*)
20152 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D__EXTENSIONS__" >&5
20153 $as_echo_n "checking CFLAGS for gcc -D__EXTENSIONS__... " >&6; }
20165 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D__EXTENSIONS__" >&5
20166 $as_echo_n "checking CPPFLAGS for gcc -D__EXTENSIONS__... " >&6; }
2015420167 if ${ac_cv_cflags_gcc_option__D__EXTENSIONS__+:} false; then :
2015520168 $as_echo_n "(cached) " >&6
2015620169 else
2019720210 .ok|.ok,*) ;;
2019820211 .|.no|.no,*) ;;
2019920212 *)
20200 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20201 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
20202 (: CFLAGS does contain ${ac_res}) 2>&5
20213 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20214 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
20215 (: CPPFLAGS does contain ${ac_res}) 2>&5
2020320216 ac_status=$?
2020420217 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2020520218 test $ac_status = 0; }
20206 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
20207 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
20219 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
20220 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
2020820221 ac_status=$?
2020920222 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2021020223 test $ac_status = 0; }
20211 CFLAGS="$CFLAGS ${ac_res}"
20224 CPPFLAGS="$CPPFLAGS ${ac_res}"
2021220225 fi
2021320226 ;;
2021420227 esac
20215 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D_XPG4_2" >&5
20216 $as_echo_n "checking CFLAGS for gcc -D_XPG4_2... " >&6; }
20228 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D_XPG4_2" >&5
20229 $as_echo_n "checking CPPFLAGS for gcc -D_XPG4_2... " >&6; }
2021720230 if ${ac_cv_cflags_gcc_option__D_XPG4_2+:} false; then :
2021820231 $as_echo_n "(cached) " >&6
2021920232 else
2026020273 .ok|.ok,*) ;;
2026120274 .|.no|.no,*) ;;
2026220275 *)
20263 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20264 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
20265 (: CFLAGS does contain ${ac_res}) 2>&5
20276 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20277 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
20278 (: CPPFLAGS does contain ${ac_res}) 2>&5
2026620279 ac_status=$?
2026720280 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2026820281 test $ac_status = 0; }
20269 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
20270 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
20282 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
20283 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
2027120284 ac_status=$?
2027220285 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2027320286 test $ac_status = 0; }
20274 CFLAGS="$CFLAGS ${ac_res}"
20287 CPPFLAGS="$CPPFLAGS ${ac_res}"
2027520288 fi
2027620289 ;;
2027720290 esac
2027820291 ;;
2027920292 hpux*)
20280 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D_XOPEN_SOURCE=500" >&5
20281 $as_echo_n "checking CFLAGS for gcc -D_XOPEN_SOURCE=500... " >&6; }
20293 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D_XOPEN_SOURCE=500" >&5
20294 $as_echo_n "checking CPPFLAGS for gcc -D_XOPEN_SOURCE=500... " >&6; }
2028220295 if ${ac_cv_cflags_gcc_option__D_XOPEN_SOURCE_500+:} false; then :
2028320296 $as_echo_n "(cached) " >&6
2028420297 else
2032520338 .ok|.ok,*) ;;
2032620339 .|.no|.no,*) ;;
2032720340 *)
20328 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20329 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
20330 (: CFLAGS does contain ${ac_res}) 2>&5
20341 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20342 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
20343 (: CPPFLAGS does contain ${ac_res}) 2>&5
2033120344 ac_status=$?
2033220345 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2033320346 test $ac_status = 0; }
20334 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
20335 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
20347 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
20348 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
2033620349 ac_status=$?
2033720350 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2033820351 test $ac_status = 0; }
20339 CFLAGS="$CFLAGS ${ac_res}"
20352 CPPFLAGS="$CPPFLAGS ${ac_res}"
2034020353 fi
2034120354 ;;
2034220355 esac
20343 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -D_XOPEN_SOURCE_EXTENDED" >&5
20344 $as_echo_n "checking CFLAGS for gcc -D_XOPEN_SOURCE_EXTENDED... " >&6; }
20356 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CPPFLAGS for gcc -D_XOPEN_SOURCE_EXTENDED" >&5
20357 $as_echo_n "checking CPPFLAGS for gcc -D_XOPEN_SOURCE_EXTENDED... " >&6; }
2034520358 if ${ac_cv_cflags_gcc_option__D_XOPEN_SOURCE_EXTENDED+:} false; then :
2034620359 $as_echo_n "(cached) " >&6
2034720360 else
2038820401 .ok|.ok,*) ;;
2038920402 .|.no|.no,*) ;;
2039020403 *)
20391 if echo " $CFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20392 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \${ac_res}"; } >&5
20393 (: CFLAGS does contain ${ac_res}) 2>&5
20404 if echo " $CPPFLAGS " | grep " ${ac_res} " 2>&1 >/dev/null
20405 then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS does contain \${ac_res}"; } >&5
20406 (: CPPFLAGS does contain ${ac_res}) 2>&5
2039420407 ac_status=$?
2039520408 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2039620409 test $ac_status = 0; }
20397 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \${ac_res}\""; } >&5
20398 (: CFLAGS="$CFLAGS ${ac_res}") 2>&5
20410 else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CPPFLAGS=\"\$CPPFLAGS \${ac_res}\""; } >&5
20411 (: CPPFLAGS="$CPPFLAGS ${ac_res}") 2>&5
2039920412 ac_status=$?
2040020413 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2040120414 test $ac_status = 0; }
20402 CFLAGS="$CFLAGS ${ac_res}"
20415 CPPFLAGS="$CPPFLAGS ${ac_res}"
2040320416 fi
2040420417 ;;
2040520418 esac
2176521778 # Override configure arguments
2176621779 ac_configure_args="$ac_configure_args --disable-libevent-regress --disable-thread-support --disable-openssl"
2176721780 ac_configure_args="$ac_configure_args --disable-malloc-replacement --disable-debug-mode --enable-function-sections"
21768 ac_configure_args="$ac_configure_args --disable-shared --enable-static"
21781 ac_configure_args="$ac_configure_args --disable-shared --enable-static --enable-silent-rules"
2176921782 subdirs="$subdirs libevent"
2177021783
2177121784 if test x"$LIBEVENT_EMBEDDED" != x; then
2177621789 LIBEVENT_EMBEDDED_FALSE=
2177721790 fi
2177821791
21792
21793
21794
21795
21796
21797 # Compatibility with pkg.m4 < 0.27
21798
21799
21800
21801 # Check whether --with-pkgconfigdir was given.
21802 if test "${with_pkgconfigdir+set}" = set; then :
21803 withval=$with_pkgconfigdir;
21804 else
21805 with_pkgconfigdir='${libdir}/pkgconfig'
21806 fi
21807
21808 pkgconfigdir=$with_pkgconfigdir
2177921809
2178021810
2178121811
2249722527
2249822528 fi
2249922529
22530 # Check if the library is usable
22531 _save_flags="$CFLAGS"
22532 _save_libs="$LIBS"
22533 CFLAGS="$CFLAGS ${XML2_CFLAGS}"
22534 LIBS="$LIBS ${XML2_LIBS}"
22535 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libxml-2 work as expected" >&5
22536 $as_echo_n "checking whether libxml-2 work as expected... " >&6; }
22537 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
22538 /* end confdefs.h. */
22539
22540 #include <libxml/encoding.h>
22541 #include <libxml/xmlwriter.h>
22542
22543 int
22544 main ()
22545 {
22546
22547 xmlDocPtr doc;
22548 xmlTextWriterPtr xw = xmlNewTextWriterDoc(&doc, 0);
22549 return (xw != NULL);
22550
22551 ;
22552 return 0;
22553 }
22554 _ACEOF
22555 if ac_fn_c_try_link "$LINENO"; then :
22556 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
22557 $as_echo "yes" >&6; }
22558 else
22559
22560 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
22561 $as_echo "no" >&6; }
22562 as_fn_error $? "*** unable to use libxml-2" "$LINENO" 5
22563 fi
22564 rm -f core conftest.err conftest.$ac_objext \
22565 conftest$ac_exeext conftest.$ac_ext
22566 CFLAGS="$_save_flags"
22567 LIBS="$_save_libs"
22568
2250022569
2250122570
2250222571
2385723926
2385823927 #######################
2385923928 # Output results
23929 LLDP_CFLAGS=$CFLAGS
23930
23931 LLDP_CPPFLAGS=$CPPFLAGS
23932
23933 LLDP_LDFLAGS=$LDFLAGS
23934
23935 CFLAGS=
23936 CPPFLAGS=
23937 LDFLAGS=
2386023938 if test x"$have_check" = x"yes"; then
2386123939 HAVE_CHECK_TRUE=
2386223940 HAVE_CHECK_FALSE='#'
2457524653 # report actual input values of CONFIG_FILES etc. instead of their
2457624654 # values after options handling.
2457724655 ac_log="
24578 This file was extended by lldpd $as_me 0.7.11, which was
24656 This file was extended by lldpd $as_me 0.7.14, which was
2457924657 generated by GNU Autoconf 2.69. Invocation command line was
2458024658
2458124659 CONFIG_FILES = $CONFIG_FILES
2464224720 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2464324721 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2464424722 ac_cs_version="\\
24645 lldpd config.status 0.7.11
24723 lldpd config.status 0.7.14
2464624724 configured by $0, generated by GNU Autoconf 2.69,
2464724725 with options \\"\$ac_cs_config\\"
2464824726
2683826916 $PACKAGE_NAME version $PACKAGE_VERSION
2683926917 OS.............: $os
2684026918 Prefix.........: $prefix
26841 C Compiler.....: $CC $CFLAGS $CPPFLAGS
26842 Linker.........: $LD $LDFLAGS $LIBS
26919 C Compiler.....: $CC $LLDP_CFLAGS $LLDP_CPPFLAGS
26920 Linker.........: $LD $LLDP_LDFLAGS $LIBS
2684326921 Libevent.......: $libevent
2684426922 Readline.......: ${ax_cv_lib_readline}
2684526923 Optional features:
4343 # Checks for programs.
4444 AC_PROG_CC
4545 AC_PROG_CC_C99
46 if test x"$ac_cv_prog_cc_c99" = x"no"; then
47 AC_MSG_FAILURE([*** C99 support is mandatory])
48 fi
4649 AC_PROG_CXX
4750 AM_PROG_CC_C_O
4851 AC_PROG_LIBTOOL
7780 AX_CFLAGS_GCC_OPTION([-fstack-protector])
7881 AX_CFLAGS_GCC_OPTION([-fstack-protector-strong])
7982 AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer])
80 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
83 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2], [CPPFLAGS])
8184 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
8285 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
8386 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
145148 # Libevent
146149 lldp_CHECK_LIBEVENT
147150
151 # Compatibility with pkg.m4 < 0.27
152 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
153 [AC_ARG_WITH([pkgconfigdir],
154 [AS_HELP_STRING([--with-pkgconfigdir],
155 [install directory for *.pc pkg-config file])],
156 [],[with_pkgconfigdir='$(libdir)/pkgconfig'])
157 AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
158
148159 #######################
149160 ### Options
150161
264275
265276 #######################
266277 # Output results
278 AC_SUBST([LLDP_CFLAGS], [$CFLAGS])
279 AC_SUBST([LLDP_CPPFLAGS], [$CPPFLAGS])
280 AC_SUBST([LLDP_LDFLAGS], [$LDFLAGS])
281 CFLAGS=
282 CPPFLAGS=
283 LDFLAGS=
267284 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
268285 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
269286 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
285302 $PACKAGE_NAME version $PACKAGE_VERSION
286303 OS.............: $os
287304 Prefix.........: $prefix
288 C Compiler.....: $CC $CFLAGS $CPPFLAGS
289 Linker.........: $LD $LDFLAGS $LIBS
305 C Compiler.....: $CC $LLDP_CFLAGS $LLDP_CPPFLAGS
306 Linker.........: $LD $LLDP_LDFLAGS $LIBS
290307 Libevent.......: $libevent
291308 Readline.......: ${ax_cv_lib_readline}
292309 Optional features:
00 edit = $(SED) \
11 -e 's|@bindir[@]|$(bindir)|g' \
2 -e 's|@sbindir[@]|$(sbindir)|g' \
23 -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
34 -e 's|@libdir[@]|$(libdir)|g' \
45 -e 's|@includedir[@]|$(includedir)|g' \
1415 -e 's|@LLDPD_CTL_SOCKET[@]|$(LLDPD_CTL_SOCKET)|g'
1516
1617 $(TEMPLATES): Makefile
17 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp
18 mv $@.tmp $@
18 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp && mv $@.tmp $@
0 Changes in version 2.0.22-stable (?? ??? 2013)
1
2 (As of 66dacfa2a58602d82e0413c8217ec38c9871d5cf.)
3
4 BUGFIXES (evhttp, crash fix)
5 o fix #73 and fix http_connection_fail_test to catch it (b618204 Greg Hazel)
0 Changes in version 2.0.22-stable (5 Jan 2015)
1
2 SECURITY FIXES (evbuffers)
3 o Avoid integer overflow bugs in evbuffer_add() and related functions. See CVE-2014-6272 advisory for more information. (20d6d4458bee5d88bda1511c225c25b2d3198d6c)
4
5 BUGFIXES (evhttp)
6 o fix #73 and fix http_connection_fail_test to catch it (crash fix) (b618204 Greg Hazel)
7 o Avoid racy bufferevent activation (5eb1788 Nate Rosenblum)
68
79 BUGFIXES (compilation and portability)
810 o Fix compilation with WIN32_HAVE_CONDITION_VARIABLES enabled (7e45739)
1113 o Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake 1.13 compat (817ea36)
1214 o Rename configure.in to configure.ac to appease newer autoconfs (0c79787)
1315 o Avoid using top_srcdir in TESTS: new automakes do not like this (a55514e)
16 o Use windows vsnprintf fixup logic on all windows environments (e826f19)
17 o Fix a compiler warning when checking for arc4random_buf linker breakage. (5cb3865)
18 o Fix another arc4random_buf-related warning (e64a2b0)
19 o Add -Qunused-arguments for clang on macos (b56611d Trond Norbye)
1420
1521 BUGFIXES (resource leaks/lock errors on error)
1622 o Avoid leaking fds on evconnlistener with no callback set (69db261)
1723 o Avoid double-close on getsockname error in evutil_ersatz_socketpair (0a822a6)
1824 o Fix a locking error in bufferevent_socket_get_dns_error. (0a5eb2e)
25 o libevent/win32_dealloc() : fix sizeof(pointer) vs sizeof(*pointer) (b8f5980 Frank Denis)
26
27 BUGFIXES: (other stability)
28 o bufferevent_pair: don't call downcast(NULL) (f2428a2)
29 o Consistently check for failure from evbuffer_pullup() (60f8f72)
30 o Fix race caused by event_active (3c7d6fc vjpai)
31
32 BUGFIXES (miscellaneous)
33 o Avoid redundant invocations of init_extension_functions for IOCP (3b77d62)
34 o Typo fixes from Linus Nordberg (cec62cb, 8cd695b)
35 o Add a few files created by "make verify" to .gitignore. (1a8295a Pierre Phaneuf)
36 o regress_buffer: fix 'memcmp' compare size (79800df Maks Naumov)
37 o Fix bufferevent setwatermark suspend_read (b34e4ac ufo2243)
38 o Fix evbuffer_peek() with len==-1 and start_at non-NULL. (fb7e76a)
39
40 BUFGIXES (evdns)
41 o Checking request nameserver for NULL, before using it. (5c710c0 Belobrov Andrey)
42 o Fix SEGFAULT after evdns_base_resume if no nameservers installed. (f8d7df8 Azat Khuzhin)
43 o Fix a crash in evdns related to shutting down evdns (9f39c88,e8fe749)
44
45 BUGFIXES (epoll)
46 o Check does arch have the epoll_create and __NR_epoll_wait syscalls. (dfe1e52 Marcin Juszkiewicz)
47
48 BUGFIXES (evutil_secure_random)
49 o Avoid other RNG initialization FS reads when urandom file is specified (9695e9c, bb52471)
50 o When we seed from /proc/sys/kernel/random/uuid, count it as success (e35b540)
51 o Document that arc4random is not a great cryptographic PRNG. (6e49696)
52 o Add evutil_secure_rng_set_urandom_device_file (2bbb5d7)
53 o Really remove RNG seeds from the stack (f5ced88)
54
1955
2056 DOCUMENTATION FIXES
2157 o Fix a mistake in evbuffer_remove() arguments in example http server code (c322c20 Gyepi Sam)
2258 o Fix a typo in a comment in buffer.h. Spotted by Alt_F4 (773b0a5)
23
59 o Clarify event_base_loop exit conditions (031a803)
60 o Use FindClose for handle from FindFirstFile in http-server.c (6466e88)
61 o Fix a typo in a doxygen comment. Reported by 亦得. (be1aeff)
2462
2563
2664 Changes in version 2.0.21-stable (18 Nov 2012)
3737 #
3838 # Once an RC is out, DO NOT MAKE ANY ABI-BREAKING CHANGES IN THAT SERIES
3939 # UNLESS YOU REALLY REALLY HAVE TO.
40 VERSION_INFO = 6:9:1
40 VERSION_INFO = 6:10:1
4141
4242 # History: RELEASE VERSION_INFO
4343 # 2.0.1-alpha -- 2.0 1:0:0
6161 # 2.0.19-stable-- 2.0 6:7:1 (No ABI change)
6262 # 2.0.20-stable-- 2.0 6:8:1 (No ABI change)
6363 # 2.0.21-stable-- 2.0 6:9:1 (No ABI change)
64 # 2.0.22-stable-- 2.0 6:10:1 (No ABI change)
6465 #
6566 # For Libevent 2.1:
6667 # 2.1.1-alpha -- 2.1 1:0:0
548548 #
549549 # Once an RC is out, DO NOT MAKE ANY ABI-BREAKING CHANGES IN THAT SERIES
550550 # UNLESS YOU REALLY REALLY HAVE TO.
551 VERSION_INFO = 6:9:1
551 VERSION_INFO = 6:10:1
552552
553553 # History: RELEASE VERSION_INFO
554554 # 2.0.1-alpha -- 2.0 1:0:0
572572 # 2.0.19-stable-- 2.0 6:7:1 (No ABI change)
573573 # 2.0.20-stable-- 2.0 6:8:1 (No ABI change)
574574 # 2.0.21-stable-- 2.0 6:9:1 (No ABI change)
575 # 2.0.22-stable-- 2.0 6:10:1 (No ABI change)
575576 #
576577 # For Libevent 2.1:
577578 # 2.1.1-alpha -- 2.1 1:0:0
276276 /* #undef _EVENT_HAVE_WORKING_KQUEUE */
277277
278278 /* Numeric representation of the version */
279 #define _EVENT_NUMERIC_VERSION 0x02001501
279 #define _EVENT_NUMERIC_VERSION 0x02001600
280280
281281 /* Name of package */
282282 #define _EVENT_PACKAGE "libevent"
333333 #define _EVENT_TIME_WITH_SYS_TIME 1
334334
335335 /* Version number of package */
336 #define _EVENT_VERSION "2.0.21-stable-dev"
336 #define _EVENT_VERSION "2.0.22-stable"
337337
338338 /* Define to appropriate substitue if compiler doesnt have __func__ */
339339 #define _EVENT___func__ __FUNCTION__
102102 # configured tree to be moved without reconfiguration.
103103
104104 AC_DEFUN([AM_AUX_DIR_EXPAND],
105 [dnl Rely on autoconf to set up CDPATH properly.
106 AC_PREREQ([2.50])dnl
107 # expand $ac_aux_dir to an absolute path
108 am_aux_dir=`cd $ac_aux_dir && pwd`
105 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
106 # Expand $ac_aux_dir to an absolute path.
107 am_aux_dir=`cd "$ac_aux_dir" && pwd`
109108 ])
110109
111110 # AM_CONDITIONAL -*- Autoconf -*-
160160 if (!CryptGenRandom(provider, sizeof(buf), buf))
161161 return -1;
162162 arc4_addrandom(buf, sizeof(buf));
163 memset(buf, 0, sizeof(buf));
163 evutil_memclear_(buf, sizeof(buf));
164164 arc4_seeded_ok = 1;
165165 return 0;
166166 }
198198 return -1;
199199
200200 arc4_addrandom(buf, sizeof(buf));
201 memset(buf, 0, sizeof(buf));
201 evutil_memclear_(buf, sizeof(buf));
202202 arc4_seeded_ok = 1;
203203 return 0;
204204 }
238238 return -1;
239239
240240 arc4_addrandom(buf, sizeof(buf));
241 memset(buf, 0, sizeof(buf));
241 evutil_memclear_(buf, sizeof(buf));
242242 arc4_seeded_ok = 1;
243243 return 0;
244244 }
283283 arc4_addrandom(entropy, nybbles/2);
284284 bytes += nybbles/2;
285285 }
286 memset(entropy, 0, sizeof(entropy));
287 memset(buf, 0, sizeof(buf));
286 evutil_memclear_(entropy, sizeof(entropy));
287 evutil_memclear_(buf, sizeof(buf));
288 arc4_seeded_ok = 1;
288289 return 0;
289290 }
290291 #endif
291292
292293 #ifndef WIN32
293294 #define TRY_SEED_URANDOM
295 static char *arc4random_urandom_filename = NULL;
296
297 static int arc4_seed_urandom_helper_(const char *fname)
298 {
299 unsigned char buf[ADD_ENTROPY];
300 int fd;
301 size_t n;
302
303 fd = evutil_open_closeonexec(fname, O_RDONLY, 0);
304 if (fd<0)
305 return -1;
306 n = read_all(fd, buf, sizeof(buf));
307 close(fd);
308 if (n != sizeof(buf))
309 return -1;
310 arc4_addrandom(buf, sizeof(buf));
311 evutil_memclear_(buf, sizeof(buf));
312 arc4_seeded_ok = 1;
313 return 0;
314 }
315
294316 static int
295317 arc4_seed_urandom(void)
296318 {
298320 static const char *filenames[] = {
299321 "/dev/srandom", "/dev/urandom", "/dev/random", NULL
300322 };
301 unsigned char buf[ADD_ENTROPY];
302 int fd, i;
303 size_t n;
323 int i;
324 if (arc4random_urandom_filename)
325 return arc4_seed_urandom_helper_(arc4random_urandom_filename);
304326
305327 for (i = 0; filenames[i]; ++i) {
306 fd = evutil_open_closeonexec(filenames[i], O_RDONLY, 0);
307 if (fd<0)
308 continue;
309 n = read_all(fd, buf, sizeof(buf));
310 close(fd);
311 if (n != sizeof(buf))
312 return -1;
313 arc4_addrandom(buf, sizeof(buf));
314 memset(buf, 0, sizeof(buf));
315 arc4_seeded_ok = 1;
316 return 0;
328 if (arc4_seed_urandom_helper_(filenames[i]) == 0) {
329 return 0;
330 }
317331 }
318332
319333 return -1;
336350 ok = 1;
337351 #endif
338352 #ifdef TRY_SEED_PROC_SYS_KERNEL_RANDOM_UUID
339 if (0 == arc4_seed_proc_sys_kernel_random_uuid())
353 if (arc4random_urandom_filename == NULL &&
354 0 == arc4_seed_proc_sys_kernel_random_uuid())
340355 ok = 1;
341356 #endif
342357 #ifdef TRY_SEED_SYSCTL_LINUX
386401 */
387402 for (i = 0; i < 12*256; i++)
388403 (void)arc4_getbyte();
404
389405 arc4_count = BYTES_BEFORE_RESEED;
390406
391407 return 0;
156156 struct evbuffer_chain *chain;
157157 size_t to_alloc;
158158
159 if (size > EVBUFFER_CHAIN_MAX - EVBUFFER_CHAIN_SIZE)
160 return (NULL);
161
159162 size += EVBUFFER_CHAIN_SIZE;
160163
161164 /* get the next largest memory that can hold the buffer */
162 to_alloc = MIN_BUFFER_SIZE;
163 while (to_alloc < size)
164 to_alloc <<= 1;
165 if (size < EVBUFFER_CHAIN_MAX / 2) {
166 to_alloc = MIN_BUFFER_SIZE;
167 while (to_alloc < size) {
168 to_alloc <<= 1;
169 }
170 } else {
171 to_alloc = size;
172 }
165173
166174 /* we get everything in one chunk */
167175 if ((chain = mm_malloc(to_alloc)) == NULL)
10011009
10021010 buf->first = chain;
10031011 if (chain) {
1012 EVUTIL_ASSERT(remaining <= chain->off);
10041013 chain->misalign += remaining;
10051014 chain->off -= remaining;
10061015 }
10671076
10681077 if (datlen) {
10691078 EVUTIL_ASSERT(chain);
1079 EVUTIL_ASSERT(datlen <= chain->off);
10701080 memcpy(data, chain->buffer + chain->misalign, datlen);
10711081 }
10721082
15421552 if (buf->freeze_end) {
15431553 goto done;
15441554 }
1555 /* Prevent buf->total_len overflow */
1556 if (datlen > EV_SIZE_MAX - buf->total_len) {
1557 goto done;
1558 }
15451559
15461560 chain = buf->last;
15471561
15551569 }
15561570
15571571 if ((chain->flags & EVBUFFER_IMMUTABLE) == 0) {
1558 remain = (size_t)(chain->buffer_len - chain->misalign - chain->off);
1572 /* Always true for mutable buffers */
1573 EVUTIL_ASSERT(chain->misalign >= 0 &&
1574 (ev_uint64_t)chain->misalign <= EVBUFFER_CHAIN_MAX);
1575 remain = chain->buffer_len - (size_t)chain->misalign - chain->off;
15591576 if (remain >= datlen) {
15601577 /* there's enough space to hold all the data in the
15611578 * current last chain */
16261643 if (buf->freeze_start) {
16271644 goto done;
16281645 }
1646 if (datlen > EV_SIZE_MAX - buf->total_len) {
1647 goto done;
1648 }
16291649
16301650 chain = buf->first;
16311651
16381658
16391659 /* we cannot touch immutable buffers */
16401660 if ((chain->flags & EVBUFFER_IMMUTABLE) == 0) {
1661 /* Always true for mutable buffers */
1662 EVUTIL_ASSERT(chain->misalign >= 0 &&
1663 (ev_uint64_t)chain->misalign <= EVBUFFER_CHAIN_MAX);
1664
16411665 /* If this chain is empty, we can treat it as
16421666 * 'empty at the beginning' rather than 'empty at the end' */
16431667 if (chain->off == 0)
16751699 tmp->next = chain;
16761700
16771701 tmp->off = datlen;
1702 EVUTIL_ASSERT(datlen <= tmp->buffer_len);
16781703 tmp->misalign = tmp->buffer_len - datlen;
16791704
16801705 memcpy(tmp->buffer + tmp->misalign, data, datlen);
17731798
17741799 /* Would expanding this chunk be affordable and worthwhile? */
17751800 if (CHAIN_SPACE_LEN(chain) < chain->buffer_len / 8 ||
1776 chain->off > MAX_TO_COPY_IN_EXPAND) {
1801 chain->off > MAX_TO_COPY_IN_EXPAND ||
1802 (datlen < EVBUFFER_CHAIN_MAX &&
1803 EVBUFFER_CHAIN_MAX - datlen >= chain->off)) {
17771804 /* It's not worth resizing this chain. Can the next one be
17781805 * used? */
17791806 if (chain->next && CHAIN_SPACE_LEN(chain->next) >= datlen) {
19011928 rmv_all = 1;
19021929 avail = 0;
19031930 } else {
1931 /* can't overflow, since only mutable chains have
1932 * huge misaligns. */
19041933 avail = (size_t) CHAIN_SPACE_LEN(chain);
19051934 chain = chain->next;
19061935 }
19111940 EVUTIL_ASSERT(chain->off == 0);
19121941 evbuffer_chain_free(chain);
19131942 }
1943 EVUTIL_ASSERT(datlen >= avail);
19141944 tmp = evbuffer_chain_new(datlen - avail);
19151945 if (tmp == NULL) {
19161946 if (rmv_all) {
20402070 unsigned long lng = EVBUFFER_MAX_READ;
20412071 if (ioctlsocket(fd, FIONREAD, &lng) < 0)
20422072 return -1;
2073 /* Can overflow, but mostly harmlessly. XXXX */
20432074 return (int)lng;
20442075 #elif defined(FIONREAD)
20452076 int n = EVBUFFER_MAX_READ;
21522183 #ifdef USE_IOVEC_IMPL
21532184 remaining = n;
21542185 for (i=0; i < nvecs; ++i) {
2155 ev_ssize_t space = (ev_ssize_t) CHAIN_SPACE_LEN(*chainp);
2156 if (space < remaining) {
2186 /* can't overflow, since only mutable chains have
2187 * huge misaligns. */
2188 size_t space = (size_t) CHAIN_SPACE_LEN(*chainp);
2189 /* XXXX This is a kludge that can waste space in perverse
2190 * situations. */
2191 if (space > EVBUFFER_CHAIN_MAX)
2192 space = EVBUFFER_CHAIN_MAX;
2193 if ((ev_ssize_t)space < remaining) {
21572194 (*chainp)->off += space;
21582195 remaining -= (int)space;
21592196 } else {
23622399 /* XXX(nickm) Don't disable this code until we know if
23632400 * the WSARecv code above works. */
23642401 void *p = evbuffer_pullup(buffer, howmuch);
2402 EVUTIL_ASSERT(p || !howmuch);
23652403 n = send(fd, p, howmuch, 0);
23662404 #else
23672405 void *p = evbuffer_pullup(buffer, howmuch);
2406 EVUTIL_ASSERT(p || !howmuch);
23682407 n = write(fd, p, howmuch);
23692408 #endif
23702409 #ifdef USE_SENDFILE
24242463 case EVBUFFER_PTR_ADD:
24252464 /* this avoids iterating over all previous chains if
24262465 we just want to advance the position */
2466 if (pos->pos < 0 || EV_SIZE_MAX - position < (size_t)pos->pos) {
2467 EVBUFFER_UNLOCK(buf);
2468 return -1;
2469 }
24272470 chain = pos->_internal.chain;
24282471 pos->pos += position;
24292472 position = pos->_internal.pos_in_chain;
24302473 break;
24312474 }
24322475
2476 EVUTIL_ASSERT(EV_SIZE_MAX - left >= position);
24332477 while (chain && position + left >= chain->off) {
24342478 left -= chain->off - position;
24352479 chain = chain->next;
24622506
24632507 ASSERT_EVBUFFER_LOCKED(buf);
24642508
2465 if (pos->pos + len > buf->total_len)
2509 if (pos->pos < 0 ||
2510 EV_SIZE_MAX - len < (size_t)pos->pos ||
2511 pos->pos + len > buf->total_len)
24662512 return -1;
24672513
24682514 chain = pos->_internal.chain;
25862632 if (n_vec == 0 && len < 0) {
25872633 /* If no vectors are provided and they asked for "everything",
25882634 * pretend they asked for the actual available amount. */
2589 len = buffer->total_len - len_so_far;
2635 len = buffer->total_len;
2636 if (start_at) {
2637 len -= start_at->pos;
2638 }
25902639 }
25912640
25922641 while (chain) {
26502699
26512700 if (sz < 0)
26522701 goto done;
2702 if (INT_MAX >= EVBUFFER_CHAIN_MAX &&
2703 (size_t)sz >= EVBUFFER_CHAIN_MAX)
2704 goto done;
26532705 if ((size_t)sz < space) {
26542706 chain->off += sz;
26552707 buf->total_len += sz;
27422794 int sendfile_okay = 1;
27432795 #endif
27442796 int ok = 1;
2797
2798 if (offset < 0 || length < 0 ||
2799 ((ev_uint64_t)length > EVBUFFER_CHAIN_MAX) ||
2800 (ev_uint64_t)offset > (ev_uint64_t)(EVBUFFER_CHAIN_MAX - length))
2801 return (-1);
27452802
27462803 #if defined(USE_SENDFILE)
27472804 if (use_sendfile) {
28482905 * can abort without side effects if the read fails.
28492906 */
28502907 while (length) {
2851 read = evbuffer_readfile(tmp, fd, (ev_ssize_t)length);
2908 ev_ssize_t to_read = length > EV_SSIZE_MAX ? EV_SSIZE_MAX : (ev_ssize_t)length;
2909 read = evbuffer_readfile(tmp, fd, to_read);
28522910 if (read == -1) {
28532911 evbuffer_free(tmp);
28542912 return (-1);
544544 bufev_private->read_watermarks_cb,
545545 EVBUFFER_CB_ENABLED|EVBUFFER_CB_NODEFER);
546546
547 if (evbuffer_get_length(bufev->input) > highmark)
547 if (evbuffer_get_length(bufev->input) >= highmark)
548548 bufferevent_wm_suspend_read(bufev);
549549 else if (evbuffer_get_length(bufev->input) < highmark)
550550 bufferevent_wm_unsuspend_read(bufev);
309309 bufferevent_pair_get_partner(struct bufferevent *bev)
310310 {
311311 struct bufferevent_pair *bev_p;
312 struct bufferevent *partner;
312 struct bufferevent *partner = NULL;
313313 bev_p = upcast(bev);
314314 if (! bev_p)
315315 return NULL;
316316
317317 incref_and_lock(bev);
318 partner = downcast(bev_p->partner);
318 if (bev_p->partner)
319 partner = downcast(bev_p->partner);
319320 decref_and_unlock(bev);
320321 return partner;
321322 }
388388
389389 /* The size of `long long', as computed by sizeof. */
390390 #undef SIZEOF_LONG_LONG
391
392 /* The size of `off_t', as computed by sizeof. */
393 #undef SIZEOF_OFF_T
391394
392395 /* The size of `pthread_t', as computed by sizeof. */
393396 #undef SIZEOF_PTHREAD_T
27992799 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
28002800 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
28012801
2802 # expand $ac_aux_dir to an absolute path
2803 am_aux_dir=`cd $ac_aux_dir && pwd`
2802 # Expand $ac_aux_dir to an absolute path.
2803 am_aux_dir=`cd "$ac_aux_dir" && pwd`
28042804
28052805 if test x"${MISSING+set}" != xset; then
28062806 case $am_aux_dir in
31143114 # Define the identity of the package.
31153115
31163116 PACKAGE=libevent
3117 VERSION=2.0.21-stable-dev
3117 VERSION=2.0.22-stable
31183118
31193119
31203120 cat >>confdefs.h <<_ACEOF
32103210 ac_config_headers="$ac_config_headers config.h"
32113211
32123212
3213 $as_echo "#define NUMERIC_VERSION 0x02001501" >>confdefs.h
3213 $as_echo "#define NUMERIC_VERSION 0x02001600" >>confdefs.h
32143214
32153215
32163216 if test "$prefix" = "NONE"; then
1409214092 _ACEOF
1409314093
1409414094
14095 # The cast to long int works around a bug in the HP C Compiler
14096 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
14097 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
14098 # This bug is HP SR number 8606223364.
14099 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5
14100 $as_echo_n "checking size of off_t... " >&6; }
14101 if ${ac_cv_sizeof_off_t+:} false; then :
14102 $as_echo_n "(cached) " >&6
14103 else
14104 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then :
14105
14106 else
14107 if test "$ac_cv_type_off_t" = yes; then
14108 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
14109 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
14110 as_fn_error 77 "cannot compute sizeof (off_t)
14111 See \`config.log' for more details" "$LINENO" 5; }
14112 else
14113 ac_cv_sizeof_off_t=0
14114 fi
14115 fi
14116
14117 fi
14118 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5
14119 $as_echo "$ac_cv_sizeof_off_t" >&6; }
14120
14121
14122
14123 cat >>confdefs.h <<_ACEOF
14124 #define SIZEOF_OFF_T $ac_cv_sizeof_off_t
14125 _ACEOF
14126
14127
1409514128
1409614129 ac_fn_c_check_type "$LINENO" "struct in6_addr" "ac_cv_type_struct_in6_addr" "#define _GNU_SOURCE
1409714130 #include <sys/types.h>
1508015113 # Disable the unused-function warnings, because these trigger
1508115114 # for minheap-internal.h related code.
1508215115 CFLAGS="$CFLAGS -Wno-unused-function"
15116
15117 # clang on macosx emits warnigns for each directory specified which
15118 # isn't "used" generating a lot of build noise (typically 3 warnings
15119 # per file
15120 case "$host_os" in
15121 darwin*)
15122 CFLAGS="$CFLAGS -Qunused-arguments"
15123 ;;
15124 esac
1508315125 fi
1508415126
1508515127 ##This will break the world on some 64-bit architectures
1010
1111 AC_CONFIG_MACRO_DIR([m4])
1212
13 AM_INIT_AUTOMAKE(libevent,2.0.21-stable-dev)
13 AM_INIT_AUTOMAKE(libevent,2.0.22-stable)
1414 AC_CONFIG_HEADERS(config.h)
15 AC_DEFINE(NUMERIC_VERSION, 0x02001501, [Numeric representation of the version])
15 AC_DEFINE(NUMERIC_VERSION, 0x02001600, [Numeric representation of the version])
1616
1717 dnl Initialize prefix.
1818 if test "$prefix" = "NONE"; then
557557 AC_CHECK_SIZEOF(short)
558558 AC_CHECK_SIZEOF(size_t)
559559 AC_CHECK_SIZEOF(void *)
560 AC_CHECK_SIZEOF(off_t)
560561
561562 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrinfo, struct sockaddr_storage], , ,
562563 [#define _GNU_SOURCE
724725 # Disable the unused-function warnings, because these trigger
725726 # for minheap-internal.h related code.
726727 CFLAGS="$CFLAGS -Wno-unused-function"
728
729 # clang on macosx emits warnigns for each directory specified which
730 # isn't "used" generating a lot of build noise (typically 3 warnings
731 # per file
732 case "$host_os" in
733 darwin*)
734 CFLAGS="$CFLAGS -Qunused-arguments"
735 ;;
736 esac
727737 fi
728738
729739 ##This will break the world on some 64-bit architectures
3030 #include <sys/syscall.h>
3131 #include <sys/epoll.h>
3232 #include <unistd.h>
33 #include <errno.h>
3334
3435 int
3536 epoll_create(int size)
3637 {
38 #if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
39 if (size <= 0) {
40 errno = EINVAL;
41 return -1;
42 }
43 return (syscall(__NR_epoll_create1, 0));
44 #else
3745 return (syscall(__NR_epoll_create, size));
46 #endif
3847 }
3948
4049 int
4756 int
4857 epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
4958 {
59 #if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
60 return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
61 #else
5062 return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
63 #endif
5164 }
152152 struct bufferevent *parent;
153153 };
154154
155 #if _EVENT_SIZEOF_OFF_T < _EVENT_SIZEOF_SIZE_T
156 typedef ev_ssize_t ev_misalign_t;
157 #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX)
158 #else
159 typedef ev_off_t ev_misalign_t;
160 #if _EVENT_SIZEOF_OFF_T > _EVENT_SIZEOF_SIZE_T
161 #define EVBUFFER_CHAIN_MAX EV_SIZE_MAX
162 #else
163 #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX)
164 #endif
165 #endif
166
155167 /** A single item in an evbuffer. */
156168 struct evbuffer_chain {
157169 /** points to next buffer in the chain */
162174
163175 /** unused space at the beginning of buffer or an offset into a
164176 * file for sendfile buffers. */
165 ev_off_t misalign;
177 ev_misalign_t misalign;
166178
167179 /** Offset into buffer + misalign at which to start writing.
168180 * In other words, the total number of bytes actually stored
726726
727727 /* this function looks for space on the inflight queue and promotes */
728728 /* requests from the waiting queue if it can. */
729 /* */
730 /* TODO: */
731 /* add return code, see at nameserver_pick() and other functions. */
729732 static void
730733 evdns_requests_pump_waiting_queue(struct evdns_base *base) {
731734 ASSERT_LOCKED(base);
732735 while (base->global_requests_inflight < base->global_max_requests_inflight &&
733736 base->global_requests_waiting) {
734737 struct request *req;
735 /* move a request from the waiting queue to the inflight queue */
738
736739 EVUTIL_ASSERT(base->req_waiting_head);
737740 req = base->req_waiting_head;
741
742 req->ns = nameserver_pick(base);
743 if (!req->ns)
744 return;
745
746 /* move a request from the waiting queue to the inflight queue */
738747 evdns_request_remove(req, &base->req_waiting_head);
739748
740749 base->global_requests_waiting--;
741750 base->global_requests_inflight++;
742751
743 req->ns = nameserver_pick(base);
744752 request_trans_id_set(req, transaction_id_pick(base));
745753
746754 evdns_request_insert(req, &REQ_HEAD(base, req->trans_id));
24402448 EVDNS_LOCK(base);
24412449 evdns_requests_pump_waiting_queue(base);
24422450 EVDNS_UNLOCK(base);
2451
24432452 return 0;
24442453 }
24452454
39363945 event_debug_unassign(&server->event);
39373946 if (server->state == 0)
39383947 (void) event_del(&server->timeout_event);
3948 if (server->probe_request) {
3949 evdns_cancel_request(server->base, server->probe_request);
3950 server->probe_request = NULL;
3951 }
39393952 event_debug_unassign(&server->timeout_event);
39403953 mm_free(server);
39413954 }
39503963 /* Requires that we hold the lock. */
39513964
39523965 /* TODO(nickm) we might need to refcount here. */
3966
3967 for (server = base->server_head; server; server = server_next) {
3968 server_next = server->next;
3969 evdns_nameserver_free(server);
3970 if (server_next == base->server_head)
3971 break;
3972 }
3973 base->server_head = NULL;
3974 base->global_good_nameservers = 0;
39533975
39543976 for (i = 0; i < base->n_req_heads; ++i) {
39553977 while (base->req_heads[i]) {
39653987 }
39663988 base->global_requests_inflight = base->global_requests_waiting = 0;
39673989
3968 for (server = base->server_head; server; server = server_next) {
3969 server_next = server->next;
3970 evdns_nameserver_free(server);
3971 if (server_next == base->server_head)
3972 break;
3973 }
3974 base->server_head = NULL;
3975 base->global_good_nameservers = 0;
39763990
39773991 if (base->global_search_state) {
39783992 for (dom = base->global_search_state->head; dom; dom = dom_next) {
12551255 static inline void
12561256 event_persist_closure(struct event_base *base, struct event *ev)
12571257 {
1258 // Define our callback, we use this to store our callback before it's executed
1259 void (*evcb_callback)(evutil_socket_t, short, void *);
1260
1261 // Other fields of *ev that must be stored before executing
1262 evutil_socket_t evcb_fd;
1263 short evcb_res;
1264 void *evcb_arg;
1265
12581266 /* reschedule the persistent event if we have a timeout. */
12591267 if (ev->ev_io_timeout.tv_sec || ev->ev_io_timeout.tv_usec) {
12601268 /* If there was a timeout, we want it to run at an interval of
12961304 run_at.tv_usec |= usec_mask;
12971305 event_add_internal(ev, &run_at, 1);
12981306 }
1299 EVBASE_RELEASE_LOCK(base, th_base_lock);
1300 (*ev->ev_callback)(ev->ev_fd, ev->ev_res, ev->ev_arg);
1307
1308 // Save our callback before we release the lock
1309 evcb_callback = ev->ev_callback;
1310 evcb_fd = ev->ev_fd;
1311 evcb_res = ev->ev_res;
1312 evcb_arg = ev->ev_arg;
1313
1314 // Release the lock
1315 EVBASE_RELEASE_LOCK(base, th_base_lock);
1316
1317 // Execute the callback
1318 (evcb_callback)(evcb_fd, evcb_res, evcb_arg);
13011319 }
13021320
13031321 /*
140140 {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
141141 #endif
142142
143 static int extension_fns_initialized = 0;
144
143145 static void
144146 init_extension_functions(struct win32_extension_fns *ext)
145147 {
154156 ext->GetAcceptExSockaddrs = get_extension_function(s,
155157 &getacceptexsockaddrs);
156158 closesocket(s);
159
160 extension_fns_initialized = 1;
157161 }
158162
159163 static struct win32_extension_fns the_extension_fns;
160 static int extension_fns_initialized = 0;
161164
162165 const struct win32_extension_fns *
163166 event_get_win32_extension_fns(void)
205205 */
206206 data = evbuffer_pullup(
207207 evbuf, len < sizeof(number) + 1 ? len : sizeof(number) + 1);
208 if (!data)
209 return (-1);
208210
209211 while (count++ < len) {
210212 ev_uint8_t lower = *data++;
311313 \
312314 /* XXX(niels): faster? */ \
313315 data = evbuffer_pullup(evbuf, offset + 1) + offset; \
316 if (!data) \
317 return (-1); \
314318 \
315319 nibbles = ((data[0] & 0xf0) >> 4) + 1; \
316320 if (nibbles > maxnibbles || (nibbles >> 1) + 1 > len) \
318322 len = (nibbles >> 1) + 1; \
319323 \
320324 data = evbuffer_pullup(evbuf, offset + len) + offset; \
325 if (!data) \
326 return (-1); \
321327 \
322328 while (nibbles > 0) { \
323329 number <<= 4; \
21082108 #endif
21092109 }
21102110
2111 /**
2112 * Volatile pointer to memset: we use this to keep the compiler from
2113 * eliminating our call to memset.
2114 */
2115 void * (*volatile evutil_memset_volatile_)(void *, int, size_t) = memset;
2116
2117 void
2118 evutil_memclear_(void *mem, size_t len)
2119 {
2120 evutil_memset_volatile_(mem, 0, len);
2121 }
2122
21112123 int
21122124 evutil_sockaddr_is_loopback(const struct sockaddr *addr)
21132125 {
4242 #include <stdlib.h>
4343 #include <string.h>
4444 int
45 evutil_secure_rng_set_urandom_device_file(char *fname)
46 {
47 (void) fname;
48 return -1;
49 }
50 int
4551 evutil_secure_rng_init(void)
4652 {
4753 /* call arc4random() now to force it to self-initialize */
6975 * and fall back otherwise. (OSX does this using some linker
7076 * trickery.)
7177 */
72 if (arc4random_buf != NULL) {
73 return arc4random_buf(buf, n);
78 {
79 void (*tptr)(void *,size_t) =
80 (void (*)(void*,size_t))arc4random_buf;
81 if (tptr != NULL) {
82 return arc4random_buf(buf, n);
83 }
7484 }
7585 #endif
7686 /* Make sure that we start out with b at a 4-byte alignment; plenty
123133 #endif
124134
125135 int
136 evutil_secure_rng_set_urandom_device_file(char *fname)
137 {
138 #ifdef TRY_SEED_URANDOM
139 _ARC4_LOCK();
140 arc4random_urandom_filename = fname;
141 _ARC4_UNLOCK();
142 #endif
143 return 0;
144 }
145
146 int
126147 evutil_secure_rng_init(void)
127148 {
128149 int val;
382382 evcon->cb = cb;
383383 evcon->cb_arg = arg;
384384
385 bufferevent_enable(evcon->bufev, EV_WRITE);
386
387385 /* Disable the read callback: we don't actually care about data;
388386 * we only care about close detection. (We don't disable reading,
389387 * since we *do* want to learn about any close events.) */
392390 evhttp_write_cb,
393391 evhttp_error_cb,
394392 evcon);
393
394 bufferevent_enable(evcon->bufev, EV_WRITE);
395395 }
396396
397397 static void
4343 with bufferevent_enable() and bufferevent_disable().
4444
4545 When reading is enabled, the bufferevent will try to read from the
46 file descriptor onto its input buffer, and and call the read callback.
46 file descriptor onto its input buffer, and call the read callback.
4747 When writing is enabled, the bufferevent will try to write data onto its
48 file descriptor when writing is enabled, and call the write callback
49 when the output buffer is sufficiently drained.
48 file descriptor when the output buffer has enough data, and call the write
49 callback when the output buffer is sufficiently drained.
5050
5151 Bufferevents come in several flavors, including:
5252
419419
420420 @param base the evdns_base to which to apply this operation
421421 @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC|
422 DNS_OPTIONS_HOSTSFILE|DNS_OPTIONS_ALL
422 DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL
423423 @param filename the path to the resolv.conf file
424424 @return 0 if successful, or various positive error codes if an error
425425 occurred (see above)
350350 /**
351351 Event dispatching loop
352352
353 This loop will run the event base until either there are no more added
354 events, or until something calls event_base_loopbreak() or
353 This loop will run the event base until either there are no more pending or
354 active, or until something calls event_base_loopbreak() or
355355 event_base_loopexit().
356356
357357 @param base the event_base structure returned by event_base_new() or
358358 event_base_new_with_config()
359 @return 0 if successful, -1 if an error occurred, or 1 if no events were
360 registered.
359 @return 0 if successful, -1 if an error occurred, or 1 if we exited because
360 no events were pending or active.
361361 @see event_base_loop()
362362 */
363363 int event_base_dispatch(struct event_base *);
644644 This is a more flexible version of event_base_dispatch().
645645
646646 By default, this loop will run the event base until either there are no more
647 added events, or until something calls event_base_loopbreak() or
648 evenet_base_loopexit(). You can override this behavior with the 'flags'
647 pending or active events, or until something calls event_base_loopbreak() or
648 event_base_loopexit(). You can override this behavior with the 'flags'
649649 argument.
650650
651651 @param eb the event_base structure returned by event_base_new() or
652652 event_base_new_with_config()
653653 @param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
654 @return 0 if successful, -1 if an error occurred, or 1 if no events were
655 registered.
654 @return 0 if successful, -1 if an error occurred, or 1 if we exited because
655 no events were pending or active.
656656 @see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE,
657657 EVLOOP_NONBLOCK
658658 */
647647
648648 /** Generate n bytes of secure pseudorandom data, and store them in buf.
649649 *
650 * By default, Libevent uses an ARC4-based random number generator, seeded
651 * using the platform's entropy source (/dev/urandom on Unix-like systems;
652 * CryptGenRandom on Windows).
650 * Current versions of Libevent use an ARC4-based random number generator,
651 * seeded using the platform's entropy source (/dev/urandom on Unix-like
652 * systems; CryptGenRandom on Windows). This is not actually as secure as it
653 * should be: ARC4 is a pretty lousy cipher, and the current implementation
654 * provides only rudimentary prediction- and backtracking-resistance. Don't
655 * use this for serious cryptographic applications.
653656 */
654657 void evutil_secure_rng_get_bytes(void *buf, size_t n);
655658
671674 */
672675 int evutil_secure_rng_init(void);
673676
677 /**
678 * Set a filename to use in place of /dev/urandom for seeding the secure
679 * PRNG. Return 0 on success, -1 on failure.
680 *
681 * Call this function BEFORE calling any other initialization or RNG
682 * functions.
683 *
684 * (This string will _NOT_ be copied internally. Do not free it while any
685 * user of the secure RNG might be running. Don't pass anything other than a
686 * real /dev/...random device file here, or you might lose security.)
687 *
688 * This API is unstable, and might change in a future libevent version.
689 */
690 int evutil_secure_rng_set_urandom_device_file(char *fname);
691
674692 /** Seed the random number generator with extra random bytes.
675693
676694 You should almost never need to call this function; it should be
263263 #endif
264264 evbuffer_add_printf(evb, "</ul></body></html>\n");
265265 #ifdef WIN32
266 CloseHandle(d);
266 FindClose(d);
267267 #else
268268 closedir(d);
269269 #endif
243243 if (memcmp(evbuffer_pullup(
244244 evb, -1), buffer, sizeof(buffer) / 2) != 0 ||
245245 memcmp(evbuffer_pullup(
246 evb_two, -1), buffer, sizeof(buffer) != 0))
246 evb_two, -1), buffer, sizeof(buffer)) != 0)
247247 tt_abort_msg("Pullup did not preserve content");
248248
249249 evbuffer_validate(evb);
319319 #endif
320320 #endif
321321
322 void evutil_memclear_(void *mem, size_t len);
323
322324 #ifdef __cplusplus
323325 }
324326 #endif
371371 mm_free(win32op->exset_out);
372372 /* XXXXX free the tree. */
373373
374 memset(win32op, 0, sizeof(win32op));
374 memset(win32op, 0, sizeof(*win32op));
375375 mm_free(win32op);
376376 }
6969 # compiler: $LTCC
7070 # compiler flags: $LTCFLAGS
7171 # linker: $LD (gnu? $with_gnu_ld)
72 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.10
72 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11
7373 # automake: $automake_version
7474 # autoconf: $autoconf_version
7575 #
7979
8080 PROGRAM=libtool
8181 PACKAGE=libtool
82 VERSION="2.4.2 Debian-2.4.2-1.10"
82 VERSION="2.4.2 Debian-2.4.2-1.11"
8383 TIMESTAMP=""
8484 package_revision=1.3337
8585
4747 # Override configure arguments
4848 ac_configure_args="$ac_configure_args --disable-libevent-regress --disable-thread-support --disable-openssl"
4949 ac_configure_args="$ac_configure_args --disable-malloc-replacement --disable-debug-mode --enable-function-sections"
50 ac_configure_args="$ac_configure_args --disable-shared --enable-static"
50 ac_configure_args="$ac_configure_args --disable-shared --enable-static --enable-silent-rules"
5151 AC_CONFIG_SUBDIRS([libevent])
5252 AM_CONDITIONAL([LIBEVENT_EMBEDDED], [test x"$LIBEVENT_EMBEDDED" != x])
5353 AC_SUBST([LIBEVENT_LIBS])
3434 # Enable some additional CFLAGS depending on the OS
3535 AC_DEFUN([lldp_CFLAGS_OS], [
3636 # Most of what we want can be enabled nowadays with _GNU_SOURCE
37 AX_CFLAGS_GCC_OPTION([-D_GNU_SOURCE]) dnl GNU systems (asprintf, ...)
37 AX_CFLAGS_GCC_OPTION([-D_GNU_SOURCE], [CPPFLAGS]) dnl GNU systems (asprintf, ...)
3838
3939 case $host_os in
4040 solaris*)
41 AX_CFLAGS_GCC_OPTION([-D__EXTENSIONS__]) dnl (CMSG_*)
42 AX_CFLAGS_GCC_OPTION([-D_XPG4_2]) dnl (CMSG_*)
41 AX_CFLAGS_GCC_OPTION([-D__EXTENSIONS__], [CPPFLAGS]) dnl (CMSG_*)
42 AX_CFLAGS_GCC_OPTION([-D_XPG4_2], [CPPFLAGS]) dnl (CMSG_*)
4343 ;;
4444 hpux*)
45 AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE=500]) dnl HP-UX
46 AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE_EXTENDED]) dnl HP-UX
45 AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE=500], [CPPFLAGS]) dnl HP-UX
46 AX_CFLAGS_GCC_OPTION([-D_XOPEN_SOURCE_EXTENDED], [CPPFLAGS]) dnl HP-UX
4747 ;;
4848 esac
4949 ])
1414 AC_MSG_RESULT([found!])
1515 ])
1616
17 # Check if the library is usable
18 _save_flags="$CFLAGS"
19 _save_libs="$LIBS"
20 CFLAGS="$CFLAGS ${XML2_CFLAGS}"
21 LIBS="$LIBS ${XML2_LIBS}"
22 AC_MSG_CHECKING([whether libxml-2 work as expected])
23 AC_LINK_IFELSE([AC_LANG_PROGRAM([
24 @%:@include <libxml/encoding.h>
25 @%:@include <libxml/xmlwriter.h>
26 ],[
27 xmlDocPtr doc;
28 xmlTextWriterPtr xw = xmlNewTextWriterDoc(&doc, 0);
29 return (xw != NULL);
30 ])],[AC_MSG_RESULT(yes)],[
31 AC_MSG_RESULT(no)
32 AC_MSG_ERROR([*** unable to use libxml-2])])
33 CFLAGS="$_save_flags"
34 LIBS="$_save_libs"
35
1736 AC_SUBST([XML2_LIBS])
1837 AC_SUBST([XML2_CFLAGS])
1938 AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support])
231231 LIPO = @LIPO@
232232 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
233233 LLDPD_PID_FILE = @LLDPD_PID_FILE@
234 LLDP_CFLAGS = @LLDP_CFLAGS@
235 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
236 LLDP_LDFLAGS = @LLDP_LDFLAGS@
234237 LN_S = @LN_S@
235238 LTLIBOBJS = @LTLIBOBJS@
236239 MAINT = @MAINT@
317320 mkdir_p = @mkdir_p@
318321 oldincludedir = @oldincludedir@
319322 pdfdir = @pdfdir@
323 pkgconfigdir = @pkgconfigdir@
320324 prefix = @prefix@
321325 program_transform_name = @program_transform_name@
322326 psdir = @psdir@
349353 @HOST_OS_OSX_TRUE@CLEANFILES = $(TEMPLATES)
350354 @HOST_OS_OSX_TRUE@edit = $(SED) \
351355 @HOST_OS_OSX_TRUE@ -e 's|@bindir[@]|$(bindir)|g' \
356 @HOST_OS_OSX_TRUE@ -e 's|@sbindir[@]|$(sbindir)|g' \
352357 @HOST_OS_OSX_TRUE@ -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
353358 @HOST_OS_OSX_TRUE@ -e 's|@libdir[@]|$(libdir)|g' \
354359 @HOST_OS_OSX_TRUE@ -e 's|@includedir[@]|$(includedir)|g' \
631636 @HOST_OS_OSX_TRUE@ chmod +x $@
632637
633638 @HOST_OS_OSX_TRUE@$(TEMPLATES): Makefile
634 @HOST_OS_OSX_TRUE@ $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp
635 @HOST_OS_OSX_TRUE@ mv $@.tmp $@
639 @HOST_OS_OSX_TRUE@ $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp && mv $@.tmp $@
636640
637641 @HOST_OS_OSX_TRUE@.PHONY: pkg requirements
638642
0 AM_CFLAGS = -I $(top_srcdir)/include
0 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
1 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
2 AM_LDFLAGS = $(LLDP_LDFLAGS)
13
24 noinst_LTLIBRARIES = libcommon-daemon-lib.la libcommon-daemon-client.la
35 include_HEADERS = lldp-const.h
287287 LIPO = @LIPO@
288288 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
289289 LLDPD_PID_FILE = @LLDPD_PID_FILE@
290 LLDP_CFLAGS = @LLDP_CFLAGS@
291 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
292 LLDP_LDFLAGS = @LLDP_LDFLAGS@
290293 LN_S = @LN_S@
291294 LTLIBOBJS = @LTLIBOBJS@
292295 MAINT = @MAINT@
373376 mkdir_p = @mkdir_p@
374377 oldincludedir = @oldincludedir@
375378 pdfdir = @pdfdir@
379 pkgconfigdir = @pkgconfigdir@
376380 prefix = @prefix@
377381 program_transform_name = @program_transform_name@
378382 psdir = @psdir@
388392 top_build_prefix = @top_build_prefix@
389393 top_builddir = @top_builddir@
390394 top_srcdir = @top_srcdir@
391 AM_CFLAGS = -I $(top_srcdir)/include
395 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
396 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
397 AM_LDFLAGS = $(LLDP_LDFLAGS)
392398 noinst_LTLIBRARIES = libcommon-daemon-lib.la libcommon-daemon-client.la
393399 include_HEADERS = lldp-const.h
394400 libcommon_daemon_lib_la_SOURCES = \
0 AM_CFLAGS = -I $(top_srcdir)/include
0 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
1 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
2 AM_LDFLAGS = $(LLDP_LDFLAGS)
13
24 sbin_PROGRAMS = lldpcli
35 man_MANS = lldpcli.8
318318 LIPO = @LIPO@
319319 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
320320 LLDPD_PID_FILE = @LLDPD_PID_FILE@
321 LLDP_CFLAGS = @LLDP_CFLAGS@
322 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
323 LLDP_LDFLAGS = @LLDP_LDFLAGS@
321324 LN_S = @LN_S@
322325 LTLIBOBJS = @LTLIBOBJS@
323326 MAINT = @MAINT@
404407 mkdir_p = @mkdir_p@
405408 oldincludedir = @oldincludedir@
406409 pdfdir = @pdfdir@
410 pkgconfigdir = @pkgconfigdir@
407411 prefix = @prefix@
408412 program_transform_name = @program_transform_name@
409413 psdir = @psdir@
419423 top_build_prefix = @top_build_prefix@
420424 top_builddir = @top_builddir@
421425 top_srcdir = @top_srcdir@
422 AM_CFLAGS = -I $(top_srcdir)/include
426 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
427 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
428 AM_LDFLAGS = $(LLDP_LDFLAGS)
423429 man_MANS = lldpcli.8
424430 dist_man_MANS = lldpctl.8
425431 lldpcli_SOURCES = client.h lldpcli.c display.c conf.c conf-med.c \
446452 CLEANFILES = $(TEMPLATES)
447453 edit = $(SED) \
448454 -e 's|@bindir[@]|$(bindir)|g' \
455 -e 's|@sbindir[@]|$(sbindir)|g' \
449456 -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
450457 -e 's|@libdir[@]|$(libdir)|g' \
451458 -e 's|@includedir[@]|$(includedir)|g' \
11711178 lldpcli.8: lldpcli.8.in
11721179
11731180 $(TEMPLATES): Makefile
1174 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp
1175 mv $@.tmp $@
1181 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp && mv $@.tmp $@
11761182
11771183 # Tell versions [3.59,3.63) of GNU make to not export all variables.
11781184 # Otherwise a system limit (for SysV at least) may be exceeded.
00 # You can put lldpd configuration snippets into this directory.
1 # Upon start, lldpd will read each files in this directory and execute content
2 # as if they were passed as arguments to lldpcli
3 #
4 # Files should be suffixed by .conf and have content like:
5 # configure system description 'my little server'
6 #
17 # See lldpcli(8) for more details.
6969 }
7070
7171 static int
72 cmd_portid_type_local(struct lldpctl_conn_t *conn, struct writer *w,
73 struct cmd_env *env, void *arg)
74 {
75 lldpctl_atom_t *iface;
76 const char *id = cmdenv_get(env, "port-id");
77 const char *descr = cmdenv_get(env, "port-descr");
78
79 if (!id || !strlen(id)) {
80 log_warnx("lldpctl", "no id speficied");
81 return 0;
82 }
83
84 while ((iface = cmd_iterate_on_interfaces(conn, env))) {
85 lldpctl_atom_t *port = lldpctl_get_port(iface);
86 if (lldpctl_atom_set_str(port, lldpctl_k_port_id, id) == NULL) {
87 log_warnx("lldpctl", "unable to set LLDP PortID."
88 " %s", lldpctl_last_strerror(conn));
89 }
90 if (descr && lldpctl_atom_set_str(port, lldpctl_k_port_descr, descr) == NULL) {
91 log_warnx("lldpctl", "unable to set LLDP Port Description."
92 " %s", lldpctl_last_strerror(conn));
93 }
94 lldpctl_atom_dec_ref(port);
95 }
96
97 return 1;
98 }
99
100 static int
72101 cmd_portid_type(struct lldpctl_conn_t *conn, struct writer *w,
73102 struct cmd_env *env, void *arg)
74103 {
166195 NEWLINE, NULL,
167196 NULL, cmd_portid_type,
168197 b_map->string);
198 } else if (!strcmp(b_map->string, "local")) {
199 struct cmd_node *port_id = commands_new(
200 commands_new(configure_lldp_portid_type,
201 b_map->string, "Local",
202 NULL, NULL, NULL),
203 NULL, "Port ID",
204 NULL, cmd_store_env_value, "port-id");
205 commands_new(port_id,
206 NEWLINE, "Set local port ID",
207 NULL, cmd_portid_type_local,
208 b_map->string);
209 commands_new(
210 commands_new(
211 commands_new(port_id,
212 "description",
213 "Also set port description",
214 NULL, NULL, NULL),
215 NULL, "Port description",
216 NULL, cmd_store_env_value, "port-descr"),
217 NEWLINE, "Set local port ID and description",
218 NULL, cmd_portid_type_local, NULL);
169219 } else if (!strcmp(b_map->string, "macaddress")) {
170220 commands_new(
171221 commands_new(configure_lldp_portid_type,
190190 (what = "unknown flag", lldpctl_atom_set_int(med_policy,
191191 lldpctl_k_med_policy_unknown,
192192 cmdenv_get(env, "unknown")?1:0)) == NULL ||
193 (what = "tagged flag", lldpctl_atom_set_int(med_policy,
194 lldpctl_k_med_policy_tagged,
195 cmdenv_get(env, "tagged")?1:0)) == NULL ||
193196 (what = "vlan",
194197 cmdenv_get(env, "vlan")?
195198 lldpctl_atom_set_str(med_policy,
425428 "unknown", "Set unknown flag",
426429 cmd_check_application_but_no, cmd_store_env_and_pop, "unknown");
427430 commands_new(
431 configure_medpolicy,
432 "tagged", "Set tagged flag",
433 cmd_check_application_but_no, cmd_store_env_and_pop, "tagged");
434 commands_new(
428435 commands_new(
429436 configure_medpolicy,
430437 "vlan", "VLAN advertising",
3232 lldpctl_last_strerror(conn));
3333 return 0;
3434 }
35
36 const char *value = cmdenv_get(env, "iface-pattern");
3537 if (lldpctl_atom_set_str(config,
36 lldpctl_k_config_iface_pattern, cmdenv_get(env, "iface-pattern")) == NULL) {
38 lldpctl_k_config_iface_pattern,
39 value) == NULL) {
3740 log_warnx("lldpctl", "unable to set iface-pattern. %s",
3841 lldpctl_last_strerror(conn));
3942 lldpctl_atom_dec_ref(config);
4043 return 0;
4144 }
42 log_info("lldpctl", "iface-pattern set to new value %s", cmdenv_get(env, "iface-pattern"));
45 log_info("lldpctl", "iface-pattern set to new value %s",
46 value?value:"(none)");
4347 lldpctl_atom_dec_ref(config);
4448 return 1;
4549 }
7478 struct cmd_env *env, void *arg)
7579 {
7680 int platform = 0;
77 const char *value = cmdenv_get(env, "description");
78 if (!value) {
81 const char *what = arg;
82 const char *value;
83 if (!strcmp(what, "system")) {
84 value = cmdenv_get(env, "description");
85 } else {
86 value = cmdenv_get(env, "platform");
7987 platform = 1;
80 value = cmdenv_get(env, "platform");
81 }
82 log_debug("lldpctl", "set %s description", platform?"platform":"system");
88 }
89 log_debug("lldpctl", "set %s description", what);
8390 lldpctl_atom_t *config = lldpctl_get_configuration(conn);
8491 if (config == NULL) {
8592 log_warnx("lldpctl", "unable to get configuration from lldpd. %s",
95102 return 0;
96103 }
97104 log_info("lldpctl", "description set to new value %s",
98 value);
105 value?value:"(none)");
99106 lldpctl_atom_dec_ref(config);
100107 return 1;
101108 }
112119 lldpctl_last_strerror(conn));
113120 return 0;
114121 }
122
115123 const char *value = cmdenv_get(env, "management-pattern");
116
117124 if (lldpctl_atom_set_str(config,
118125 lldpctl_k_config_mgmt_pattern, value) == NULL) {
119126 log_warnx("lldpctl", "unable to set management pattern. %s",
121128 lldpctl_atom_dec_ref(config);
122129 return 0;
123130 }
124 log_info("lldpctl", "management pattaren set to new value %s", value);
131 log_info("lldpctl", "management pattaren set to new value %s",
132 value?value:"(none)");
125133 lldpctl_atom_dec_ref(config);
126134 return 1;
127135 }
138146 lldpctl_last_strerror(conn));
139147 return 0;
140148 }
149
141150 const char *value = cmdenv_get(env, "hostname");
142
143151 if (lldpctl_atom_set_str(config,
144152 lldpctl_k_config_hostname, value) == NULL) {
145153 log_warnx("lldpctl", "unable to set system name. %s",
147155 lldpctl_atom_dec_ref(config);
148156 return 0;
149157 }
150 log_info("lldpctl", "system name set to new value %s", value);
158 log_info("lldpctl", "system name set to new value %s",
159 value?value:"(none)");
151160 lldpctl_atom_dec_ref(config);
152161 return 1;
153162 }
310319 NULL, "Chassis description",
311320 NULL, cmd_store_env_value, "description"),
312321 NEWLINE, "Override chassis description",
313 NULL, cmd_system_description, NULL);
322 NULL, cmd_system_description, "system");
323 commands_new(
324 commands_new(unconfigure_system,
325 "description", "Don't override chassis description",
326 NULL, NULL, NULL),
327 NEWLINE, "Don't override chassis description",
328 NULL, cmd_system_description, "system");
314329
315330 commands_new(
316331 commands_new(
320335 NULL, "Platform description (CDP)",
321336 NULL, cmd_store_env_value, "platform"),
322337 NEWLINE, "Override platform description",
323 NULL, cmd_system_description, NULL);
338 NULL, cmd_system_description, "platform");
339 commands_new(
340 commands_new(unconfigure_system,
341 "platform", "Don't override platform description",
342 NULL, NULL, NULL),
343 NEWLINE, "Don't override platform description",
344 NULL, cmd_system_description, "platform");
324345
325346 commands_new(
326347 commands_new(
330351 NULL, "System name",
331352 NULL, cmd_store_env_value, "hostname"),
332353 NEWLINE, "Override system name",
354 NULL, cmd_hostname, NULL);
355 commands_new(
356 commands_new(unconfigure_system,
357 "hostname", "Don't override system name",
358 NULL, NULL, NULL),
359 NEWLINE, "Don't override system name",
333360 NULL, cmd_hostname, NULL);
334361
335362 commands_new(
347374 NULL, cmd_store_env_value, "management-pattern"),
348375 NEWLINE, "Set IP management pattern",
349376 NULL, cmd_management, NULL);
377 commands_new(
378 commands_new(
379 commands_new(
380 commands_new(unconfigure_system,
381 "ip", "IP related options",
382 NULL, NULL, NULL),
383 "management", "IP management related options",
384 NULL, NULL, NULL),
385 "pattern", "Delete any IP management pattern",
386 NULL, NULL, NULL),
387 NEWLINE, "Delete any IP management pattern",
388 NULL, cmd_management, NULL);
350389
351390 commands_new(
352391 commands_new(
357396 NULL, cmd_store_env_value, "iface-pattern"),
358397 NEWLINE, "Set active interface pattern",
359398 NULL, cmd_iface_pattern, NULL);
399 commands_new(
400 commands_new(unconfigure_interface,
401 "pattern", "Delete any interface pattern",
402 NULL, NULL, NULL),
403 NEWLINE, "Delete any interface pattern",
404 NULL, cmd_iface_pattern, NULL);
360405
361406 commands_new(
362407 commands_new(configure_interface,
224224 TAILQ_INSERT_TAIL(priv, root, next);
225225 root->el = json_object();
226226 if (root->el == NULL)
227 fatalx("cannot create JSON root object");
227 fatalx("lldpctl", "cannot create JSON root object");
228228
229229 result = malloc(sizeof(*result));
230230 if (result == NULL) fatal(NULL, NULL);
136136 /* memory will leak... */
137137 } else {
138138 struct json_element *first = TAILQ_FIRST(p);
139 fprintf(stdout, "%s", json_object_to_json_string(first->el));
139 int json_flags = (JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);
140 fprintf(stdout, "%s", json_object_to_json_string_ext(first->el, json_flags));
140141 json_object_put(first->el);
141142 TAILQ_REMOVE(p, first, next);
142143 free(first);
143144 }
145 fprintf(stdout, "\n");
144146 free(p);
145147 free(w);
146148 }
159161 TAILQ_INSERT_TAIL(priv, root, next);
160162 root->el = json_object_new_object();
161163 if (root->el == NULL)
162 fatalx("cannot create JSON root object");
164 fatalx("lldpctl", "cannot create JSON root object");
163165
164166 result = malloc(sizeof(*result));
165167 if (result == NULL) fatal(NULL, NULL);
173173 .Ic uname -n .
174174 .Ed
175175
176 .Cd unconfigure
177 .Cd system hostname
178 .Bd -ragged -offset XXXXXX
179 Do not override system hostname and restore the use of the node name.
180 .Ed
181
176182 .Cd configure
177183 .Cd system description Ar description
178184 .Bd -ragged -offset XXXXXX
180186 kernel name, node name, kernel version, build date and architecture.
181187 .Ed
182188
189 .Cd unconfigure
190 .Cd system description
191 .Bd -ragged -offset XXXXXX
192 Do not override chassis description and use a value computed from node
193 name, kernel name, kernel version, build date and architecture instead.
194 .Ed
195
183196 .Cd configure
184197 .Cd system platform Ar description
185198 .Bd -ragged -offset XXXXXX
187200 kernel name. This value is currently only used for CDP.
188201 .Ed
189202
203 .Cd unconfigure
204 .Cd system platform
205 .Bd -ragged -offset XXXXXX
206 Do not override platform description and use the kernel name. This
207 option undoes the previous one.
208 .Ed
209
190210 .Cd configure
191211 .Cd system interface pattern Ar pattern
192212 .Bd -ragged -offset XXXXXX
193 Specify which interface to listen to. Without this option,
213 Specify which interface to listen and send LLDPDU to. Without this
214 option,
194215 .Nm lldpd
195 will listen on all available physical interfaces. This option can use
216 will use all available physical interfaces. This option can use
196217 wildcards. Several interfaces can be specified separated by commas.
197218 It is also possible to blacklist an interface by suffixing it with an
198219 exclamation mark. It is possible to whitelist an interface by
201222 example, with
202223 .Em eth*,!eth1,!eth2
203224 .Nm lldpd
204 will only listen to interfaces starting by
225 will only use interfaces starting by
205226 .Em eth
206227 with the exception of
207228 .Em eth1
210231 While with
211232 .Em *,!eth*,!!eth1
212233 .Nm
213 will listen to all interfaces, except interfaces starting by
234 will use all interfaces, except interfaces starting by
214235 .Em eth
215236 with the exception of
216237 .Em eth1 .
219240 is specified, it will be accepted even if this is a VLAN interface.
220241 .Ed
221242
243 .Cd unconfigure
244 .Cd system interface pattern
245 .Bd -ragged -offset XXXXXX
246 Remove any previously configured interface pattern and use all
247 physical interafces. This option undoes the previous one.
248 .Ed
249
222250 .Cd configure
223251 .Cd system interface description
224252 .Bd -ragged -offset XXXXXX
227255 .Nm lldpd
228256 to override this description with the name of the peer neighbor if one
229257 is found or with the number of neighbors found.
258 .Ed
259
260 .Cd unconfigure
261 .Cd system interface descripton
262 .Bd -ragged -offset XXXXXX
263 Do not update interface description with the name of the peer
264 neighbor. This option undoes the previous one.
230265 .Ed
231266
232267 .Cd configure
265300 .Bd -ragged -offset XXXXXX
266301 Specify the management addresses of this system. As for interfaces
267302 (described above), this option can use wildcards and inversions.
268 Without this option, the first IPv4 and the first IPv6 are used. If
269 only negative patterns are provided, only one IPv4 and one IPv6
270 addresses are chosen. Otherwise, many of them can be selected. If you
271 want to blacklist IPv6 addresses, you can use
303 Without this option, the first IPv4 and the first IPv6 are used. If an
304 exact IP address is provided, it is used as a management address
305 without any check. If only negative patterns are provided, only one
306 IPv4 and one IPv6 addresses are chosen. Otherwise, many of them can be
307 selected. If you want to blacklist IPv6 addresses, you can use
272308 .Em !*:* .
273309 .Ed
274310
275 .Cd configure
276 .Cd portidsubtype ifname
277 .Cd ifname | macaddress
311 .Cd unconfigure
312 .Cd system ip management pattern
313 .Bd -ragged -offset XXXXXX
314 Unset any specific pattern for matching management addresses. This
315 option undoes the previous one.
316 .Ed
317
318 .Cd configure
319 .Cd portidsubtype
320 .Cd ifname | macaddress | local Ar value Op Cd description Ar description
278321 .Bd -ragged -offset XXXXXX
279322 Force port ID subtype. By default,
280323 .Nm
283326 interface name will be used as port identifier and the description
284327 will be the interface alias. With this command, you can force the port
285328 identifier to be the interface name (with
286 .Cd ifname )
287 or the MAC address (with
288 .Cd macaddress ) .
329 .Cd ifname ) ,
330 the MAC address (with
331 .Cd macaddress )
332 or a local value (with
333 .Cd value ) .
334 In the latest case, the local value should be provided.
335 Optionally, a port description can also be provided after the local
336 value.
289337 .Ed
290338
291339 .Cd configure
481529 .Cd med policy
482530 .Cd application Ar application
483531 .Op Cd unknown
532 .Op Cd tagged
484533 .Op Cd vlan Ar vlan
485534 .Op Cd priority Ar priority
486535 .Op Cd dscp Ar dscp
522571 .Cd vlan
523572 tells which 802.1q VLAN ID has to be advertised for the network
524573 policy. A valid value is between 1 and 4094.
574 .Cd tagged
575 tells the VLAN should be tagged for the specified application type.
525576 .Cd priority
526577 allows one to specify IEEE 802.1d / IEEE 802.1p Layer 2 Priority, also
527578 known as Class of Service (CoS), to be used for the specified
528 application type. It should be one of those values:
579 application type. This field is usually ignored if no VLAN is
580 specified. It should be one of those values:
529581 .Bl -bullet -compact -offset XXXXXXXX
530582 .It
531583 background
125125
126126 priv = malloc(sizeof(*priv));
127127 if (!priv) {
128 fatalx("out of memory");
128 fatalx("lldpctl", "out of memory");
129129 return NULL;
130130 }
131131
135135
136136 result = malloc(sizeof(struct writer));
137137 if (!result) {
138 fatalx("out of memory");
138 fatalx("llpctl", "out of memory");
139139 free(priv);
140140 return NULL;
141141 }
4343 char input[2*strlen(line) + 3]; /* 3 = 2 for '\n ' and 1 for \0 */
4444 memset(input, 0, 2*strlen(line) + 3);
4545 for (int pos = 0; line[pos]; pos++) {
46 if (line[pos] == '#' && !escaped && !quote)
47 break;
4648 if (!escaped && strchr(escapes, line[pos]))
4749 escaped = 1;
4850 else if (!escaped && strchr(quotes, line[pos]) && !quote) {
9090
9191 priv = malloc( sizeof( *priv ) );
9292 if ( ! priv ) {
93 fatalx("out of memory");
93 fatalx("lldpctl", "out of memory");
9494 return NULL;
9595 }
9696
9797 priv->xw = xmlNewTextWriterDoc(&(priv->doc), 0);
9898 if ( ! priv->xw ) {
99 fatalx("cannot create xml writer");
99 fatalx("lldpctl", "cannot create xml writer");
100100 return NULL;
101101 }
102102
103103 xmlTextWriterSetIndent(priv->xw, 4);
104104
105105 if (xmlTextWriterStartDocument(priv->xw, NULL, MY_ENCODING, NULL) < 0 ) {
106 fatalx("cannot start xml document");
106 fatalx("lldpctl", "cannot start xml document");
107107 return NULL;
108108 }
109109
110110 result = malloc( sizeof( struct writer ) );
111111 if ( ! result ) {
112 fatalx("out of memory");
112 fatalx("lldpctl", "out of memory");
113113 return NULL;
114114 }
115115
7979 host_triplet = @host@
8080 subdir = src/compat
8181 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am asprintf.c \
82 setproctitle.c realloc.c strnlen.c malloc.c fgetln.c daemon.c \
83 vsyslog.c strndup.c strlcpy.c $(top_srcdir)/depcomp
82 vsyslog.c realloc.c setproctitle.c strlcpy.c strnlen.c \
83 malloc.c daemon.c fgetln.c strndup.c $(top_srcdir)/depcomp
8484 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
8585 am__aclocal_m4_deps = $(top_srcdir)/m4/alignof.m4 \
8686 $(top_srcdir)/m4/args.m4 \
250250 LIPO = @LIPO@
251251 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
252252 LLDPD_PID_FILE = @LLDPD_PID_FILE@
253 LLDP_CFLAGS = @LLDP_CFLAGS@
254 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
255 LLDP_LDFLAGS = @LLDP_LDFLAGS@
253256 LN_S = @LN_S@
254257 LTLIBOBJS = @LTLIBOBJS@
255258 MAINT = @MAINT@
336339 mkdir_p = @mkdir_p@
337340 oldincludedir = @oldincludedir@
338341 pdfdir = @pdfdir@
342 pkgconfigdir = @pkgconfigdir@
339343 prefix = @prefix@
340344 program_transform_name = @program_transform_name@
341345 psdir = @psdir@
4545
4646 if ((s = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
4747 return -1;
48 if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) {
49 close(s);
50 return -1;
51 }
4852 su.sun_family = AF_UNIX;
4953 strlcpy(su.sun_path, name, sizeof(su.sun_path));
5054 if (bind(s, (struct sockaddr *)&su, sizeof(struct sockaddr_un)) == -1) {
0 AM_CFLAGS = -I $(top_srcdir)/include
0 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
1 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
2 AM_LDFLAGS = $(LLDP_LDFLAGS)
13 BUILT_SOURCES =
24 CLEANFILES =
35
2123 pattern.c \
2224 probes.d trace.h
2325 liblldpd_la_CFLAGS = $(AM_CFLAGS) @LIBEVENT_CFLAGS@
24 liblldpd_la_CPPFLAGS = -DSYSCONFDIR='"$(sysconfdir)"' -DLLDPCLI_PATH='"$(sbindir)/lldpcli"'
26 liblldpd_la_CPPFLAGS = $(AM_CPPFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' -DLLDPCLI_PATH='"$(sbindir)/lldpcli"'
2527 liblldpd_la_LIBADD = \
2628 $(top_builddir)/src/libcommon-daemon-client.la \
2729 $(top_builddir)/src/libcommon-daemon-lib.la @LIBEVENT_LIBS@
7375 interfaces-bsd.c \
7476 dmi-osx.c \
7577 priv-bsd.c
76 liblldpd_la_LDFLAGS = -framework Foundation
78 liblldpd_la_LDFLAGS = $(AM_LDFLAGS)
79 liblldpd_la_LDFLAGS += -framework Foundation
7780 liblldpd_la_LDFLAGS += -framework CoreFoundation -framework IOKit
7881 liblldpd_la_LDFLAGS += -framework IOKit
7982 endif
421421 LIPO = @LIPO@
422422 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
423423 LLDPD_PID_FILE = @LLDPD_PID_FILE@
424 LLDP_CFLAGS = @LLDP_CFLAGS@
425 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
426 LLDP_LDFLAGS = @LLDP_LDFLAGS@
424427 LN_S = @LN_S@
425428 LTLIBOBJS = @LTLIBOBJS@
426429 MAINT = @MAINT@
507510 mkdir_p = @mkdir_p@
508511 oldincludedir = @oldincludedir@
509512 pdfdir = @pdfdir@
513 pkgconfigdir = @pkgconfigdir@
510514 prefix = @prefix@
511515 program_transform_name = @program_transform_name@
512516 psdir = @psdir@
522526 top_build_prefix = @top_build_prefix@
523527 top_builddir = @top_builddir@
524528 top_srcdir = @top_srcdir@
525 AM_CFLAGS = -I $(top_srcdir)/include
529 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
530 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
531 AM_LDFLAGS = $(LLDP_LDFLAGS)
526532 BUILT_SOURCES = $(am__append_11) $(am__append_17)
527533 CLEANFILES = $(am__append_12) $(am__append_18) $(TEMPLATES)
528534 man_MANS = lldpd.8
536542 $(am__append_7) $(am__append_8) $(am__append_14)
537543 liblldpd_la_CFLAGS = $(AM_CFLAGS) @LIBEVENT_CFLAGS@ $(am__append_9) \
538544 $(am__append_15)
539 liblldpd_la_CPPFLAGS = -DSYSCONFDIR='"$(sysconfdir)"' -DLLDPCLI_PATH='"$(sbindir)/lldpcli"'
545 liblldpd_la_CPPFLAGS = $(AM_CPPFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' -DLLDPCLI_PATH='"$(sbindir)/lldpcli"'
540546 liblldpd_la_LIBADD = $(top_builddir)/src/libcommon-daemon-client.la \
541547 $(top_builddir)/src/libcommon-daemon-lib.la @LIBEVENT_LIBS@ \
542548 $(am__append_16)
543 @HOST_OS_OSX_TRUE@liblldpd_la_LDFLAGS = -framework Foundation \
544 @HOST_OS_OSX_TRUE@ -framework CoreFoundation -framework IOKit \
545 @HOST_OS_OSX_TRUE@ -framework IOKit
549 @HOST_OS_OSX_TRUE@liblldpd_la_LDFLAGS = $(AM_LDFLAGS) -framework \
550 @HOST_OS_OSX_TRUE@ Foundation -framework CoreFoundation \
551 @HOST_OS_OSX_TRUE@ -framework IOKit -framework IOKit
546552 lldpd_SOURCES = main.c
547553 lldpd_LDADD = liblldpd.la @LIBEVENT_LDFLAGS@ $(am__append_10) \
548554 $(am__append_19)
555561 TEMPLATES = lldpd.8 lldpd.service lldpd.sysusers.conf
556562 edit = $(SED) \
557563 -e 's|@bindir[@]|$(bindir)|g' \
564 -e 's|@sbindir[@]|$(sbindir)|g' \
558565 -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
559566 -e 's|@libdir[@]|$(libdir)|g' \
560567 -e 's|@includedir[@]|$(includedir)|g' \
12981305 lldpd.sysusers.conf: lldpd.sysusers.conf.in
12991306
13001307 $(TEMPLATES): Makefile
1301 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp
1302 mv $@.tmp $@
1308 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp && mv $@.tmp $@
13031309
13041310 # Tell versions [3.59,3.63) of GNU make to not export all variables.
13051311 # Otherwise a system limit (for SysV at least) may be exceeded.
18301830 }
18311831
18321832 void
1833 agent_init(struct lldpd *cfg, char *agentx)
1833 agent_init(struct lldpd *cfg, const char *agentx)
18341834 {
18351835 int rc;
18361836
1717 #include "lldpd.h"
1818 #include "trace.h"
1919
20 static int
20 static ssize_t
2121 client_handle_none(struct lldpd *cfg, enum hmsg_type *type,
2222 void *input, int input_len, void **output, int *subscribed)
2323 {
2727 }
2828
2929 /* Return the global configuration */
30 static int
30 static ssize_t
3131 client_handle_get_configuration(struct lldpd *cfg, enum hmsg_type *type,
3232 void *input, int input_len, void **output, int *subscribed)
3333 {
4141 return output_len;
4242 }
4343
44 static char*
45 xstrdup(const char *str)
46 {
47 if (!str) return NULL;
48 return strdup(str);
49 }
50
4451 /* Change the global configuration */
45 static int
52 static ssize_t
4653 client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type,
4754 void *input, int input_len, void **output, int *subscribed)
4855 {
5461 *type = NONE;
5562 return 0;
5663 }
57
64
65 #define CHANGED(w) (config->w != cfg->g_config.w)
66 #define CHANGED_STR(w) (!(config->w == cfg->g_config.w || \
67 (config->w && cfg->g_config.w && !strcmp(config->w, cfg->g_config.w))))
68
5869 /* What needs to be done? Transmit delay? */
59 if (config->c_tx_interval > 0) {
60 log_debug("rpc", "client change transmit interval to %d",
61 config->c_tx_interval);
62 cfg->g_config.c_tx_interval = config->c_tx_interval;
63 LOCAL_CHASSIS(cfg)->c_ttl = cfg->g_config.c_tx_interval *
64 cfg->g_config.c_tx_hold;
65 }
66 if (config->c_tx_hold > 0) {
70 if (CHANGED(c_tx_interval) && config->c_tx_interval != 0) {
71 if (config->c_tx_interval < 0) {
72 log_debug("rpc", "client asked for immediate retransmission");
73 levent_send_now(cfg);
74 } else {
75 log_debug("rpc", "client change transmit interval to %d",
76 config->c_tx_interval);
77 cfg->g_config.c_tx_interval = config->c_tx_interval;
78 LOCAL_CHASSIS(cfg)->c_ttl = cfg->g_config.c_tx_interval *
79 cfg->g_config.c_tx_hold;
80 }
81 }
82 if (CHANGED(c_tx_hold) && config->c_tx_hold > 0) {
6783 log_debug("rpc", "client change transmit hold to %d",
68 config->c_tx_hold);
84 config->c_tx_hold);
6985 cfg->g_config.c_tx_hold = config->c_tx_hold;
7086 LOCAL_CHASSIS(cfg)->c_ttl = cfg->g_config.c_tx_interval *
71 cfg->g_config.c_tx_hold;
72 }
73 if (config->c_tx_interval < 0) {
74 log_debug("rpc", "client asked for immediate retransmission");
75 levent_send_now(cfg);
76 }
77 if (config->c_lldp_portid_type > LLDP_PORTID_SUBTYPE_UNKNOWN &&
78 config->c_lldp_portid_type <= LLDP_PORTID_SUBTYPE_MAX) {
79 log_debug("rpc", "change lldp portid tlv subtype to %d",
80 config->c_lldp_portid_type);
81 cfg->g_config.c_lldp_portid_type = config->c_lldp_portid_type;
82 levent_update_now(cfg);
87 cfg->g_config.c_tx_hold;
88 }
89 if (CHANGED(c_lldp_portid_type) &&
90 config->c_lldp_portid_type > LLDP_PORTID_SUBTYPE_UNKNOWN &&
91 config->c_lldp_portid_type <= LLDP_PORTID_SUBTYPE_MAX) {
92 log_debug("rpc", "change lldp portid tlv subtype to %d",
93 config->c_lldp_portid_type);
94 cfg->g_config.c_lldp_portid_type = config->c_lldp_portid_type;
95 levent_update_now(cfg);
8396 }
8497 /* Pause/resume */
85 if (config->c_paused != cfg->g_config.c_paused) {
98 if (CHANGED(c_paused)) {
8699 log_debug("rpc", "client asked to %s lldpd",
87100 config->c_paused?"pause":"resume");
88101 cfg->g_config.c_paused = config->c_paused;
90103 }
91104
92105 #ifdef ENABLE_LLDPMED
93 if (config->c_enable_fast_start) {
94 cfg->g_config.c_enable_fast_start = (config->c_enable_fast_start == 1);
106 if (CHANGED(c_enable_fast_start)) {
107 cfg->g_config.c_enable_fast_start = config->c_enable_fast_start;
95108 log_debug("rpc", "client asked to %s fast start",
96109 cfg->g_config.c_enable_fast_start?"enable":"disable");
97110 }
98 if (config->c_tx_fast_interval) {
111 if (CHANGED(c_tx_fast_interval) &&
112 config->c_tx_fast_interval > 0) {
99113 log_debug("rpc", "change fast interval to %d", config->c_tx_fast_interval);
100114 cfg->g_config.c_tx_fast_interval = config->c_tx_fast_interval;
101115 }
102116 #endif
103 if (config->c_iface_pattern) {
104 log_debug("rpc", "change interface pattern to %s", config->c_iface_pattern);
117 if (CHANGED_STR(c_iface_pattern)) {
118 log_debug("rpc", "change interface pattern to %s",
119 config->c_iface_pattern?config->c_iface_pattern:"(NULL)");
105120 free(cfg->g_config.c_iface_pattern);
106 cfg->g_config.c_iface_pattern = strdup(config->c_iface_pattern);
107 levent_update_now(cfg);
108 }
109 if (config->c_mgmt_pattern) {
110 log_debug("rpc", "change management pattern to %s", config->c_mgmt_pattern);
121 cfg->g_config.c_iface_pattern = xstrdup(config->c_iface_pattern);
122 levent_update_now(cfg);
123 }
124 if (CHANGED_STR(c_mgmt_pattern)) {
125 log_debug("rpc", "change management pattern to %s",
126 config->c_mgmt_pattern?config->c_mgmt_pattern:"(NULL)");
111127 free(cfg->g_config.c_mgmt_pattern);
112 cfg->g_config.c_mgmt_pattern = strdup(config->c_mgmt_pattern);
113 levent_update_now(cfg);
114 }
115 if (config->c_description) {
116 log_debug("rpc", "change chassis description to %s", config->c_description);
128 cfg->g_config.c_mgmt_pattern = xstrdup(config->c_mgmt_pattern);
129 levent_update_now(cfg);
130 }
131 if (CHANGED_STR(c_description)) {
132 log_debug("rpc", "change chassis description to %s",
133 config->c_description?config->c_description:"(NULL)");
117134 free(cfg->g_config.c_description);
118 cfg->g_config.c_description = strdup(config->c_description);
119 levent_update_now(cfg);
120 }
121 if (config->c_platform) {
122 log_debug("rpc", "change platform description to %s", config->c_platform);
135 cfg->g_config.c_description = xstrdup(config->c_description);
136 levent_update_now(cfg);
137 }
138 if (CHANGED_STR(c_platform)) {
139 log_debug("rpc", "change platform description to %s",
140 config->c_platform?config->c_platform:"(NULL)");
123141 free(cfg->g_config.c_platform);
124 cfg->g_config.c_platform = strdup(config->c_platform);
125 levent_update_now(cfg);
126 }
127 if (config->c_hostname) {
128 log_debug("rpc", "change system name to %s", config->c_hostname);
142 cfg->g_config.c_platform = xstrdup(config->c_platform);
143 levent_update_now(cfg);
144 }
145 if (CHANGED_STR(c_hostname)) {
146 log_debug("rpc", "change system name to %s",
147 config->c_hostname?config->c_hostname:"(NULL");
129148 free(cfg->g_config.c_hostname);
130 cfg->g_config.c_hostname = strdup(config->c_hostname);
131 levent_update_now(cfg);
132 }
133 if (config->c_set_ifdescr != cfg->g_config.c_set_ifdescr) {
149 cfg->g_config.c_hostname = xstrdup(config->c_hostname);
150 levent_update_now(cfg);
151 }
152 if (CHANGED(c_set_ifdescr)) {
134153 log_debug("rpc", "%s setting of interface description based on discovered neighbors",
135154 config->c_set_ifdescr?"enable":"disable");
136155 cfg->g_config.c_set_ifdescr = config->c_set_ifdescr;
137156 levent_update_now(cfg);
138157 }
139 if (config->c_promisc != cfg->g_config.c_promisc) {
158 if (CHANGED(c_promisc)) {
140159 log_debug("rpc", "%s promiscuous mode on managed interfaces",
141160 config->c_promisc?"enable":"disable");
142161 cfg->g_config.c_promisc = config->c_promisc;
143162 levent_update_now(cfg);
144163 }
145 if (config->c_bond_slave_src_mac_type != 0) {
164 if (CHANGED(c_bond_slave_src_mac_type)) {
146165 if (config->c_bond_slave_src_mac_type >
147166 LLDP_BOND_SLAVE_SRC_MAC_TYPE_UNKNOWN &&
148167 config->c_bond_slave_src_mac_type <=
167186 Input: nothing.
168187 Output: list of interface names (lldpd_interface_list)
169188 */
170 static int
189 static ssize_t
171190 client_handle_get_interfaces(struct lldpd *cfg, enum hmsg_type *type,
172191 void *input, int input_len, void **output, int *subscribed)
173192 {
174193 struct lldpd_interface *iff, *iff_next;
175194 struct lldpd_hardware *hardware;
176 int output_len;
195 ssize_t output_len;
177196
178197 /* Build the list of interfaces */
179198 struct lldpd_interface_list ifs;
210229 Input: name of the interface (serialized)
211230 Output: Information about the interface (lldpd_hardware)
212231 */
213 static int
232 static ssize_t
214233 client_handle_get_interface(struct lldpd *cfg, enum hmsg_type *type,
215234 void *input, int input_len, void **output, int *subscribed)
216235 {
229248 log_debug("rpc", "client request interface %s", name);
230249 TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries)
231250 if (!strcmp(hardware->h_ifname, name)) {
232 int output_len = lldpd_hardware_serialize(hardware, output);
251 ssize_t output_len = lldpd_hardware_serialize(hardware, output);
233252 free(name);
234253 if (output_len <= 0) {
235254 *type = NONE;
248267 Input: name of the interface, policy/location/power setting to be modified
249268 Output: nothing
250269 */
251 static int
270 static ssize_t
252271 client_handle_set_port(struct lldpd *cfg, enum hmsg_type *type,
253272 void *input, int input_len, void **output, int *subscribed)
254273 {
273292 TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries)
274293 if (!strcmp(hardware->h_ifname, set->ifname)) {
275294 struct lldpd_port *port = &hardware->h_lport;
276 (void)port;
295 if (set->local_id) {
296 log_debug("rpc", "requested change to Port ID");
297 free(port->p_id);
298 port->p_id = strdup(set->local_id);
299 port->p_id_len = strlen(set->local_id);
300 port->p_id_subtype = LLDP_PORTID_SUBTYPE_LOCAL;
301 }
302 if (set->local_descr) {
303 log_debug("rpc", "requested change to Port Description");
304 free(port->p_descr);
305 port->p_descr = strdup(set->local_descr);
306 }
277307 #ifdef ENABLE_LLDPMED
278308 if (set->med_policy && set->med_policy->type > 0) {
279309 log_debug("rpc", "requested change to MED policy");
332362
333363 if (ret == 0)
334364 log_warn("rpc", "no interface %s found", set->ifname);
365 else
366 levent_update_now(cfg);
335367
336368 set_port_finished:
337369 if (!ret) *type = NONE;
338370 free(set->ifname);
371 free(set->local_id);
372 free(set->local_descr);
339373 #ifdef ENABLE_LLDPMED
340374 free(set->med_policy);
341375 if (set->med_location) free(set->med_location->data);
349383 }
350384
351385 /* Register subscribtion to neighbor changes */
352 static int
386 static ssize_t
353387 client_handle_subscribe(struct lldpd *cfg, enum hmsg_type *type,
354388 void *input, int input_len, void **output, int *subscribed)
355389 {
361395 struct client_handle {
362396 enum hmsg_type type;
363397 const char *name;
364 int (*handle)(struct lldpd*, enum hmsg_type *,
398 ssize_t (*handle)(struct lldpd*, enum hmsg_type *,
365399 void *, int, void **, int *);
366400 };
367401
383417 int *subscribed)
384418 {
385419 struct client_handle *ch;
386 void *answer; size_t len, sent;
420 void *answer; ssize_t len, sent;
387421
388422 log_debug("rpc", "handle client request");
389423 for (ch = client_handles; ch->handle != NULL; ch++) {
382382 }
383383
384384 static void
385 levent_priv(evutil_socket_t fd, short what, void *arg)
386 {
387 struct event_base *base = arg;
388 ssize_t n;
389 int err;
390 char one;
391 (void)what;
392 /* Check if we have some data available. We need to pass the socket in
393 * non-blocking mode to be able to run the check without disruption. */
394 levent_make_socket_nonblocking(fd);
395 n = read(fd, &one, 0); err = errno;
396 levent_make_socket_blocking(fd);
397
398 switch (n) {
399 case -1:
400 if (err == EAGAIN || err == EWOULDBLOCK)
401 /* No data, all good */
402 return;
403 log_warnx("event", "unable to poll monitor process, exit");
404 break;
405 case 0:
406 log_warnx("event", "monitor process has terminated, exit");
407 break;
408 default:
409 /* Unfortunately, dead code, if we have data, we have requested
410 * 0 byte, so we will fall in the previous case. It seems safer
411 * to ask for 0 byte than asking for 1 byte. In the later case,
412 * if we have to speak with the monitor again before exiting, we
413 * would be out of sync. */
414 log_warnx("event", "received unexpected data from monitor process, exit");
415 break;
416 }
417 event_base_loopbreak(base);
418 }
419
420 static void
385421 levent_dump(evutil_socket_t fd, short what, void *arg)
386422 {
387423 struct event_base *base = arg;
431467 log_debug("event", "initialize libevent");
432468 event_set_log_callback(levent_log_cb);
433469 if (!(cfg->g_base = event_base_new()))
434 fatalx("unable to create a new libevent base");
470 fatalx("event", "unable to create a new libevent base");
435471 log_info("event", "libevent %s initialized with %s method",
436472 event_get_version(),
437473 event_base_get_method(cfg->g_base));
444480 levent_snmp_timeout,
445481 cfg);
446482 if (!cfg->g_snmp_timeout)
447 fatalx("unable to setup timeout function for SNMP");
483 fatalx("event", "unable to setup timeout function for SNMP");
448484 if ((cfg->g_snmp_fds =
449485 malloc(sizeof(struct ev_l))) == NULL)
450 fatalx("unable to allocate memory for SNMP events");
486 fatalx("event", "unable to allocate memory for SNMP events");
451487 TAILQ_INIT(levent_snmp_fds(cfg));
452488 }
453489 #endif
457493 if (!(cfg->g_main_loop = event_new(cfg->g_base, -1, 0,
458494 levent_update_and_send,
459495 cfg)))
460 fatalx("unable to setup main timer");
496 fatalx("event", "unable to setup main timer");
461497 event_active(cfg->g_main_loop, EV_TIMEOUT, 1);
462498
463499 /* Setup unix socket */
500 struct event *ctl_event;
464501 log_debug("event", "register Unix socket");
465502 TAILQ_INIT(&lldpd_clients);
466503 levent_make_socket_nonblocking(cfg->g_ctl);
467 if ((cfg->g_ctl_event = event_new(cfg->g_base, cfg->g_ctl,
504 if ((ctl_event = event_new(cfg->g_base, cfg->g_ctl,
468505 EV_READ|EV_PERSIST, levent_ctl_accept, cfg)) == NULL)
469 fatalx("unable to setup control socket event");
470 event_add(cfg->g_ctl_event, NULL);
506 fatalx("event", "unable to setup control socket event");
507 event_add(ctl_event, NULL);
508
509 /* Somehow monitor the monitor process */
510 struct event *monitor_event;
511 log_debug("event", "monitor the monitor process");
512 if ((monitor_event = event_new(cfg->g_base, priv_fd(PRIV_UNPRIVILEGED),
513 EV_READ|EV_PERSIST, levent_priv, cfg->g_base)) == NULL)
514 fatalx("event", "unable to monitor monitor process");
515 event_add(monitor_event, NULL);
471516
472517 /* Signals */
473518 log_debug("event", "register signals");
474 signal(SIGHUP, SIG_IGN);
475519 evsignal_add(evsignal_new(cfg->g_base, SIGUSR1,
476520 levent_dump, cfg->g_base),
477521 NULL);
787831 }
788832 return 0;
789833 }
834
835 int
836 levent_make_socket_blocking(int fd)
837 {
838 int flags;
839 if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
840 log_warn("event", "fcntl(%d, F_GETFL)", fd);
841 return -1;
842 }
843 if (!(flags & O_NONBLOCK)) return 0;
844 if (fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == -1) {
845 log_warn("event", "fcntl(%d, F_SETFL)", fd);
846 return -1;
847 }
848 return 0;
849 }
00 /* -*- mode: c; c-file-style: "openbsd" -*- */
11 /*
22 * Copyright (c) 2009 Vincent Bernat <bernat@luffy.cx>
3 * Copyright (c) 2014 Michael Chapman
34 *
45 * Permission to use, copy, modify, and/or distribute this software for any
56 * purpose with or without fee is hereby granted, provided that the above
2526
2627 /* This set of macro are used to build packets. The current position in buffer
2728 * is `pos'. The length of the remaining space in buffer is `length'. `type'
28 * should be a member of `types'. This was stolen from ladvd which was adapted
29 * from Net::CDP. */
29 * should be a member of `types'.
30 *
31 * This was stolen from ladvd which was adapted from Net::CDP. The original
32 * author of those macros, Michael Chapman, has relicensed those macros under
33 * the ISC license. */
3034
3135 #define POKE(value, type, func) \
3236 ((length >= sizeof(type)) && \
445445 interfaces_setup_multicast(cfg, hardware->h_ifname, 0);
446446
447447 /* Then, we open a raw interface for the master */
448 log_debug("interfaces", "bonded device %s has master %s(%d)",
449 hardware->h_ifname, master->name, master->index);
448450 if ((fd = priv_iface_init(master->index, master->name)) == -1) {
449451 close(hardware->h_sendfd);
450452 return -1;
550552 iface->name);
551553 continue;
552554 }
553 hardware->h_data = calloc(1, sizeof(struct bond_master));
554 if (!hardware->h_data) {
555 bmaster = hardware->h_data = calloc(1, sizeof(struct bond_master));
556 if (!bmaster) {
555557 log_warn("interfaces", "not enough memory");
556558 lldpd_hardware_cleanup(cfg, hardware);
557559 continue;
558560 }
561 bmaster->index = master->index;
562 strlcpy(bmaster->name, master->name, IFNAMSIZ);
559563 if (iface_bond_init(cfg, hardware) != 0) {
560564 log_warn("interfaces", "unable to initialize %s",
561565 hardware->h_ifname);
339339 }
340340 }
341341
342 #ifndef IN_IS_ADDR_LOOPBACK
342 #undef IN_IS_ADDR_LOOPBACK
343343 #define IN_IS_ADDR_LOOPBACK(a) ((a)->s_addr == htonl(INADDR_LOOPBACK))
344 #endif
345 #ifndef IN_IS_ADDR_ANY
344 #undef IN_IS_ADDR_ANY
346345 #define IN_IS_ADDR_ANY(a) ((a)->s_addr == htonl(INADDR_ANY))
347 #endif
348 #ifndef IN_IS_ADDR_GLOBAL
349 #define IN_IS_ADDR_GLOBAL(a) (!IN_IS_ADDR_LOOPBACK(a) && !IN_IS_ADDR_ANY(a))
350 #endif
351 #ifndef IN6_IS_ADDR_GLOBAL
346 #undef IN_IS_ADDR_LINKLOCAL
347 #define IN_IS_ADDR_LINKLOCAL(a) (((a)->s_addr & htonl(0xffff0000)) == htonl(0xa9fe0000))
348 #undef IN_IS_ADDR_GLOBAL
349 #define IN_IS_ADDR_GLOBAL(a) (!IN_IS_ADDR_LOOPBACK(a) && !IN_IS_ADDR_ANY(a) && !IN_IS_ADDR_LINKLOCAL(a))
350 #undef IN6_IS_ADDR_GLOBAL
352351 #define IN6_IS_ADDR_GLOBAL(a) \
353352 (!IN6_IS_ADDR_LOOPBACK(a) && !IN6_IS_ADDR_LINKLOCAL(a))
354 #endif
353
354 /* Add management addresses for the given family. We only take one of each
355 address family, unless a pattern is provided and is not all negative. For
356 example !*:*,!10.* will only blacklist addresses. We will pick the first IPv4
357 address not matching 10.*.
358 */
359 static int
360 interfaces_helper_mgmt_for_af(struct lldpd *cfg,
361 int af,
362 struct interfaces_address_list *addrs,
363 int global, int allnegative)
364 {
365 struct interfaces_address *addr;
366 struct lldpd_mgmt *mgmt;
367 char addrstrbuf[INET6_ADDRSTRLEN];
368 int found = 0;
369 void *sin_addr_ptr;
370 size_t sin_addr_size;
371
372 TAILQ_FOREACH(addr, addrs, next) {
373 if (addr->address.ss_family != lldpd_af(af))
374 continue;
375
376 switch (af) {
377 case LLDPD_AF_IPV4:
378 sin_addr_ptr = &((struct sockaddr_in *)&addr->address)->sin_addr;
379 sin_addr_size = sizeof(struct in_addr);
380 if (global) {
381 if (!IN_IS_ADDR_GLOBAL((struct in_addr *)sin_addr_ptr))
382 continue;
383 } else {
384 if (!IN_IS_ADDR_LINKLOCAL((struct in_addr *)sin_addr_ptr))
385 continue;
386 }
387 break;
388 case LLDPD_AF_IPV6:
389 sin_addr_ptr = &((struct sockaddr_in6 *)&addr->address)->sin6_addr;
390 sin_addr_size = sizeof(struct in6_addr);
391 if (global) {
392 if (!IN6_IS_ADDR_GLOBAL((struct in6_addr *)sin_addr_ptr))
393 continue;
394 } else {
395 if (!IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)sin_addr_ptr))
396 continue;
397 }
398 break;
399 default:
400 assert(0);
401 continue;
402 }
403 if (inet_ntop(lldpd_af(af), sin_addr_ptr,
404 addrstrbuf, sizeof(addrstrbuf)) == NULL) {
405 log_warn("interfaces", "unable to convert IP address to a string");
406 continue;
407 }
408 if (cfg->g_config.c_mgmt_pattern == NULL ||
409 pattern_match(addrstrbuf, cfg->g_config.c_mgmt_pattern, allnegative)) {
410 mgmt = lldpd_alloc_mgmt(af, sin_addr_ptr, sin_addr_size,
411 addr->index);
412 if (mgmt == NULL) {
413 assert(errno == ENOMEM); /* anything else is a bug */
414 log_warn("interfaces", "out of memory error");
415 return found;
416 }
417 log_debug("interfaces", "add management address %s", addrstrbuf);
418 TAILQ_INSERT_TAIL(&LOCAL_CHASSIS(cfg)->c_mgmt, mgmt, m_entries);
419 found = 1;
420
421 /* Don't take additional address if the pattern is all negative. */
422 if (allnegative) break;
423 }
424 }
425 return found;
426 }
355427
356428 /* Find a management address in all available interfaces, even those that were
357429 already handled. This is a special interface handler because it does not
361433 interfaces_helper_mgmt(struct lldpd *cfg,
362434 struct interfaces_address_list *addrs)
363435 {
364 struct interfaces_address *addr;
365 char addrstrbuf[INET6_ADDRSTRLEN];
366 struct lldpd_mgmt *mgmt;
367 void *sin_addr_ptr;
368 size_t sin_addr_size;
436 int allnegative = 0;
369437 int af;
370 int allnegative = 0;
438 const char *pattern = cfg->g_config.c_mgmt_pattern;
371439
372440 lldpd_chassis_mgmt_cleanup(LOCAL_CHASSIS(cfg));
373441
442 /* Is the pattern provided an actual IP address? */
443 if (pattern && strpbrk(pattern, "!,*?") == NULL) {
444 struct in6_addr addr;
445 size_t addr_size;
446 for (af = LLDPD_AF_UNSPEC + 1;
447 af != LLDPD_AF_LAST; af++) {
448 switch (af) {
449 case LLDPD_AF_IPV4: addr_size = sizeof(struct in_addr); break;
450 case LLDPD_AF_IPV6: addr_size = sizeof(struct in6_addr); break;
451 default: assert(0);
452 }
453 if (inet_pton(lldpd_af(af), pattern, &addr) == 1)
454 break;
455 }
456 if (af == LLDPD_AF_LAST) {
457 log_debug("interfaces",
458 "interface management pattern is an incorrect IP");
459 } else {
460 struct lldpd_mgmt *mgmt;
461 mgmt = lldpd_alloc_mgmt(af, &addr, addr_size, 0);
462 if (mgmt == NULL) {
463 log_warn("interfaces", "out of memory error");
464 return;
465 }
466 log_debug("interfaces", "add exact management address %s",
467 pattern);
468 TAILQ_INSERT_TAIL(&LOCAL_CHASSIS(cfg)->c_mgmt, mgmt, m_entries);
469 }
470 return;
471 }
472
374473 /* Is the pattern provided all negative? */
375 if (cfg->g_config.c_mgmt_pattern == NULL) allnegative = 1;
376 else if (cfg->g_config.c_mgmt_pattern[0] == '!') {
474 if (pattern == NULL) allnegative = 1;
475 else if (pattern[0] == '!') {
377476 /* If each comma is followed by '!', its an all
378477 negative pattern */
379 char *sep = cfg->g_config.c_mgmt_pattern;
478 const char *sep = pattern;
380479 while ((sep = strchr(sep, ',')) &&
381480 (*(++sep) == '!'));
382481 if (sep == NULL) allnegative = 1;
384483
385484 /* Find management addresses */
386485 for (af = LLDPD_AF_UNSPEC + 1; af != LLDPD_AF_LAST; af++) {
387 /* We only take one of each address family, unless a
388 pattern is provided and is not all negative. For
389 example !*:*,!10.* will only blacklist
390 addresses. We will pick the first IPv4 address not
391 matching 10.*. */
392 TAILQ_FOREACH(addr, addrs, next) {
393 if (addr->address.ss_family != lldpd_af(af))
394 continue;
395
396 switch (af) {
397 case LLDPD_AF_IPV4:
398 sin_addr_ptr = &((struct sockaddr_in *)&addr->address)->sin_addr;
399 sin_addr_size = sizeof(struct in_addr);
400 if (!IN_IS_ADDR_GLOBAL((struct in_addr *)sin_addr_ptr))
401 continue;
402 break;
403 case LLDPD_AF_IPV6:
404 sin_addr_ptr = &((struct sockaddr_in6 *)&addr->address)->sin6_addr;
405 sin_addr_size = sizeof(struct in6_addr);
406 if (!IN6_IS_ADDR_GLOBAL((struct in6_addr *)sin_addr_ptr))
407 continue;
408 break;
409 default:
410 assert(0);
411 continue;
412 }
413 if (inet_ntop(lldpd_af(af), sin_addr_ptr,
414 addrstrbuf, sizeof(addrstrbuf)) == NULL) {
415 log_warn("interfaces", "unable to convert IP address to a string");
416 continue;
417 }
418 if (cfg->g_config.c_mgmt_pattern == NULL ||
419 pattern_match(addrstrbuf, cfg->g_config.c_mgmt_pattern, allnegative)) {
420 mgmt = lldpd_alloc_mgmt(af, sin_addr_ptr, sin_addr_size,
421 addr->index);
422 if (mgmt == NULL) {
423 assert(errno == ENOMEM); /* anything else is a bug */
424 log_warn("interfaces", "out of memory error");
425 return;
426 }
427 log_debug("interfaces", "add management address %s", addrstrbuf);
428 TAILQ_INSERT_TAIL(&LOCAL_CHASSIS(cfg)->c_mgmt, mgmt, m_entries);
429
430 /* Don't take additional address if the pattern is all negative. */
431 if (allnegative) break;
432 }
433 }
486 (void)(interfaces_helper_mgmt_for_af(cfg, af, addrs, 1, allnegative) ||
487 interfaces_helper_mgmt_for_af(cfg, af, addrs, 0, allnegative));
434488 }
435489 }
436490
441495 struct interfaces_device *iface)
442496 {
443497 struct lldpd_port *port = &hardware->h_lport;
498
499 if (port->p_id_subtype == LLDP_PORTID_SUBTYPE_LOCAL)
500 return;
444501
445502 /* We need to set the portid to what the client configured.
446503 This can be done from the CLI.
451508 hardware->h_ifname);
452509 port->p_id_subtype = LLDP_PORTID_SUBTYPE_IFNAME;
453510 port->p_id_len = strlen(hardware->h_ifname);
454 if (port->p_id != NULL) {
455 free(port->p_id);
456 }
511 free(port->p_id);
457512 if ((port->p_id = calloc(1, port->p_id_len)) == NULL)
458513 fatal("interfaces", NULL);
459514 memcpy(port->p_id, hardware->h_ifname, port->p_id_len);
464519 log_debug("interfaces", "use MAC address for %s",
465520 hardware->h_ifname);
466521 port->p_id_subtype = LLDP_PORTID_SUBTYPE_LLADDR;
467 if (port->p_id != NULL) {
468 free(port->p_id);
469 }
522 free(port->p_id);
470523 if ((port->p_id = calloc(1, ETHER_ADDR_LEN)) == NULL)
471524 fatal("interfaces", NULL);
472525 memcpy(port->p_id, hardware->h_lladdr, ETHER_ADDR_LEN);
477530 /* use the actual alias in the port description */
478531 log_debug("interfaces", "using alias in description for %s",
479532 hardware->h_ifname);
480 if (port->p_descr != NULL) {
481 free(port->p_descr);
482 }
533 free(port->p_descr);
483534 port->p_descr = strdup(iface->alias);
484535 } else {
485536 /* use the ifname in the port description until alias is set */
486537 log_debug("interfaces", "using ifname in description for %s",
487538 hardware->h_ifname);
488 if (port->p_descr != NULL) {
489 free(port->p_descr);
490 }
539 free(port->p_descr);
491540 port->p_descr = strdup(hardware->h_ifname);
492541 }
493542 }
5151 }
5252 }
5353
54 int
55 lldp_send(struct lldpd *global,
56 struct lldpd_hardware *hardware)
54 static int _lldp_send(struct lldpd *global,
55 struct lldpd_hardware *hardware,
56 u_int8_t c_id_subtype,
57 char *c_id,
58 int c_id_len,
59 u_int8_t p_id_subtype,
60 char *p_id,
61 int p_id_len,
62 int shutdown)
5763 {
5864 struct lldpd_port *port;
5965 struct lldpd_chassis *chassis;
7783 int i;
7884 const u_int8_t med[] = LLDP_TLV_ORG_MED;
7985 #endif
80
81 log_debug("lldp", "send LLDP PDU to %s",
82 hardware->h_ifname);
83
8486 port = &hardware->h_lport;
8587 chassis = port->p_chassis;
8688 length = hardware->h_mtu;
101103 /* Chassis ID */
102104 if (!(
103105 POKE_START_LLDP_TLV(LLDP_TLV_CHASSIS_ID) &&
104 POKE_UINT8(chassis->c_id_subtype) &&
105 POKE_BYTES(chassis->c_id, chassis->c_id_len) &&
106 POKE_UINT8(c_id_subtype) &&
107 POKE_BYTES(c_id, c_id_len) &&
106108 POKE_END_LLDP_TLV))
107109 goto toobig;
108110
109111 /* Port ID */
110112 if (!(
111113 POKE_START_LLDP_TLV(LLDP_TLV_PORT_ID) &&
112 POKE_UINT8(port->p_id_subtype) &&
113 POKE_BYTES(port->p_id, port->p_id_len) &&
114 POKE_UINT8(p_id_subtype) &&
115 POKE_BYTES(p_id, p_id_len) &&
114116 POKE_END_LLDP_TLV))
115117 goto toobig;
116118
117119 /* Time to live */
118120 if (!(
119121 POKE_START_LLDP_TLV(LLDP_TLV_TTL) &&
120 POKE_UINT16(chassis->c_ttl) &&
122 POKE_UINT16(shutdown?0:chassis->c_ttl) &&
121123 POKE_END_LLDP_TLV))
122124 goto toobig;
125
126 if (shutdown)
127 goto end;
123128
124129 /* System name */
125130 if (chassis->c_name && *chassis->c_name != '\0') {
423428 }
424429 #endif
425430
431 end:
426432 /* END */
427433 if (!(
428434 POKE_START_LLDP_TLV(LLDP_TLV_END) &&
440446 hardware->h_tx_cnt++;
441447
442448 /* We assume that LLDP frame is the reference */
443 if ((frame = (struct lldpd_frame*)malloc(
449 if (!shutdown && (frame = (struct lldpd_frame*)malloc(
444450 sizeof(int) + pos - packet)) != NULL) {
445451 frame->size = pos - packet;
446452 memcpy(&frame->frame, packet, frame->size);
449455 (memcmp(hardware->h_lport.p_lastframe->frame, frame->frame,
450456 frame->size) != 0)) {
451457 free(hardware->h_lport.p_lastframe);
452 hardware->h_lport.p_lastframe = frame;
453 hardware->h_lport.p_lastchange = time(NULL);
454 } else
455 free(frame);
458 hardware->h_lport.p_lastframe = frame;
459 hardware->h_lport.p_lastchange = time(NULL);
460 } else free(frame);
456461 }
457462
458463 free(packet);
461466 toobig:
462467 free(packet);
463468 return E2BIG;
469 }
470
471 /* Send a shutdown LLDPDU. */
472 int
473 lldp_send_shutdown(struct lldpd *global,
474 struct lldpd_hardware *hardware)
475 {
476 if (hardware->h_lchassis_previous_id == NULL ||
477 hardware->h_lport_previous_id == NULL)
478 return 0;
479 return _lldp_send(global, hardware,
480 hardware->h_lchassis_previous_id_subtype,
481 hardware->h_lchassis_previous_id,
482 hardware->h_lchassis_previous_id_len,
483 hardware->h_lport_previous_id_subtype,
484 hardware->h_lport_previous_id,
485 hardware->h_lport_previous_id_len,
486 1);
487 }
488
489 int
490 lldp_send(struct lldpd *global,
491 struct lldpd_hardware *hardware)
492 {
493 struct lldpd_port *port = &hardware->h_lport;
494 struct lldpd_chassis *chassis = port->p_chassis;
495 int ret;
496
497 /* Check if we have a change. */
498 if (hardware->h_lchassis_previous_id != NULL &&
499 hardware->h_lport_previous_id != NULL &&
500 (hardware->h_lchassis_previous_id_subtype != chassis->c_id_subtype ||
501 hardware->h_lchassis_previous_id_len != chassis->c_id_len ||
502 hardware->h_lport_previous_id_subtype != port->p_id_subtype ||
503 hardware->h_lport_previous_id_len != port->p_id_len ||
504 memcmp(hardware->h_lchassis_previous_id,
505 chassis->c_id, chassis->c_id_len) ||
506 memcmp(hardware->h_lport_previous_id,
507 port->p_id, port->p_id_len))) {
508 log_info("lldp", "MSAP has changed for port %s, sending a shutdown LLDPDU",
509 hardware->h_ifname);
510 if ((ret = lldp_send_shutdown(global, hardware)) != 0)
511 return ret;
512 }
513
514 log_debug("lldp", "send LLDP PDU to %s",
515 hardware->h_ifname);
516
517 if ((ret = _lldp_send(global, hardware,
518 chassis->c_id_subtype,
519 chassis->c_id,
520 chassis->c_id_len,
521 port->p_id_subtype,
522 port->p_id,
523 port->p_id_len,
524 0)) != 0)
525 return ret;
526
527 /* Record current chassis and port ID */
528 free(hardware->h_lchassis_previous_id);
529 hardware->h_lchassis_previous_id_subtype = chassis->c_id_subtype;
530 hardware->h_lchassis_previous_id_len = chassis->c_id_len;
531 if ((hardware->h_lchassis_previous_id = malloc(chassis->c_id_len)) != NULL)
532 memcpy(hardware->h_lchassis_previous_id, chassis->c_id,
533 chassis->c_id_len);
534 free(hardware->h_lport_previous_id);
535 hardware->h_lport_previous_id_subtype = port->p_id_subtype;
536 hardware->h_lport_previous_id_len = port->p_id_len;
537 if ((hardware->h_lport_previous_id = malloc(port->p_id_len)) != NULL)
538 memcpy(hardware->h_lport_previous_id, port->p_id,
539 port->p_id_len);
540
541 return 0;
464542 }
465543
466544 #define CHECK_TLV_SIZE(x, name) \
482560 const char dot3[] = LLDP_TLV_ORG_DOT3;
483561 const char med[] = LLDP_TLV_ORG_MED;
484562 const char dcbx[] = LLDP_TLV_ORG_DCBX;
485 char orgid[3];
563 unsigned char orgid[3];
486564 int length, gotend = 0, ttl_received = 0;
487565 int tlv_size, tlv_type, tlv_subtype;
488566 u_int8_t *pos, *tlv;
624702 case LLDP_TLV_MGMT_ADDR:
625703 CHECK_TLV_SIZE(1, "Management address");
626704 addr_str_length = PEEK_UINT8;
627 CHECK_TLV_SIZE(addr_str_length, "Management address");
705 CHECK_TLV_SIZE(1 + addr_str_length, "Management address");
628706 PEEK_BYTES(addr_str_buffer, addr_str_length);
629707 addr_length = addr_str_length - 1;
630708 addr_family = addr_str_buffer[0];
631709 addr_ptr = &addr_str_buffer[1];
632 CHECK_TLV_SIZE(5, "Management address");
710 CHECK_TLV_SIZE(1 + addr_str_length + 5, "Management address");
633711 iface_subtype = PEEK_UINT8;
634712 iface_number = PEEK_UINT32;
635713
726804 goto malformed;
727805 }
728806 pi->p_pi_len = PEEK_UINT8;
729 CHECK_TLV_SIZE(1 + pi->p_pi_len, "PI");
807 CHECK_TLV_SIZE(5 + pi->p_pi_len, "PI");
730808 if ((pi->p_pi =
731809 (char *)calloc(1, pi->p_pi_len)) == NULL) {
732810 log_warn("lldp", "unable to alloc pid name for "
185185 .It Fl m Ar management
186186 Specify the management addresses of this system. As for interfaces
187187 (described below), this option can use wildcards and inversions.
188 Without this option, the first IPv4 and the first IPv6 are used. If
189 only negative patterns are provided, only one IPv4 and one IPv6
190 addresses are chosen. Otherwise, many of them can be selected. If you
191 want to blacklist IPv6 addresses, you can use
188 Without this option, the first IPv4 and the first IPv6 are used. If an
189 exact IP address is provided, it is used as a management address
190 without any check. If only negative patterns are provided, only one
191 IPv4 and one IPv6 addresses are chosen. Otherwise, many of them can be
192 selected. If you want to blacklist IPv6 addresses, you can use
192193 .Em !*:* .
193194 .It Fl u Ar file
194195 Specify the Unix-domain socket used for communication with
195196 .Xr lldpctl 8 .
196197 .It Fl I Ar interfaces
197 Specify which interface to listen to. Without this option,
198 .Nm
199 will listen on all available physical interfaces. This option can use
198 Specify which interface to listen and send LLDPDU to. Without this
199 option,
200 .Nm
201 will use all available physical interfaces. This option can use
200202 wildcards. Several interfaces can be specified separated by commas.
201203 It is also possible to blacklist an interface by suffixing it with an
202204 exclamation mark. It is possible to whitelist an interface by
205207 example, with
206208 .Em eth*,!eth1,!eth2
207209 .Nm
208 will only listen to interfaces starting by
210 will only use interfaces starting by
209211 .Em eth
210212 with the exception of
211213 .Em eth1
214216 While with
215217 .Em *,!eth*,!!eth1
216218 .Nm
217 will listen to all interfaces, except interfaces starting by
219 will use all interfaces, except interfaces starting by
218220 .Em eth
219221 with the exception of
220222 .Em eth1 .
206206 {
207207 log_debug("alloc", "cleanup hardware port %s", hardware->h_ifname);
208208
209 free(hardware->h_lport_previous);
210 free(hardware->h_lchassis_previous_id);
211 free(hardware->h_lport_previous_id);
209212 lldpd_port_cleanup(&hardware->h_lport, 1);
210213 if (hardware->h_ops && hardware->h_ops->cleanup)
211214 hardware->h_ops->cleanup(cfg, hardware);
291294 /* Reset timer for ports that have been changed. */
292295 struct lldpd_hardware *hardware;
293296 TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) {
294 /* We need to compute a checksum of the local port. To do this,
295 * we zero out fields that are not significant, marshal the
296 * port, compute the checksum, then restore. */
297 /* We keep a flat copy of the local port to see if there is any
298 * change. To do this, we zero out fields that are not
299 * significant, marshal the port, then restore. */
297300 struct lldpd_port *port = &hardware->h_lport;
298 u_int16_t cksum;
299301 u_int8_t *output = NULL;
300 size_t output_len;
301 char save[offsetof(struct lldpd_port, p_id_subtype)];
302 ssize_t output_len;
303 char save[LLDPD_PORT_START_MARKER];
302304 memcpy(save, port, sizeof(save));
303305 /* coverity[suspicious_sizeof]
304306 We intentionally partially memset port */
311313 hardware->h_ifname);
312314 continue;
313315 }
314 cksum = frame_checksum(output, output_len, 0);
315 free(output);
316 if (cksum != hardware->h_lport_cksum) {
316
317 /* Compare with the previous value */
318 if (hardware->h_lport_previous &&
319 output_len == hardware->h_lport_previous_len &&
320 !memcmp(output, hardware->h_lport_previous, output_len)) {
321 log_debug("localchassis",
322 "no change detected for port %s",
323 hardware->h_ifname);
324 } else {
317325 log_debug("localchassis",
318326 "change detected for port %s, resetting its timer",
319327 hardware->h_ifname);
320 hardware->h_lport_cksum = cksum;
321328 levent_schedule_pdu(hardware);
322 } else {
323 log_debug("localchassis",
324 "no change detected for port %s",
325 hardware->h_ifname);
326 }
329 }
330
331 /* Update the value */
332 free(hardware->h_lport_previous);
333 hardware->h_lport_previous = output;
334 hardware->h_lport_previous_len = output_len;
327335 }
328336 }
329337
897905 free(buffer);
898906 }
899907
908 static void
909 lldpd_send_shutdown(struct lldpd_hardware *hardware)
910 {
911 struct lldpd *cfg = hardware->h_cfg;
912 if (cfg->g_config.c_receiveonly || cfg->g_config.c_paused) return;
913 if ((hardware->h_flags & IFF_RUNNING) == 0)
914 return;
915
916 /* It's safe to call `lldp_send_shutdown()` because shutdown LLDPU will
917 * only be emitted if LLDP was sent on that port. */
918 if (lldp_send_shutdown(hardware->h_cfg, hardware) != 0)
919 log_warnx("send", "unable to send shutdown LLDPDU on %s",
920 hardware->h_ifname);
921 }
922
900923 void
901924 lldpd_send(struct lldpd_hardware *hardware)
902925 {
10061029 log_debug("localchassis", "use overridden system name `%s`", cfg->g_config.c_hostname);
10071030 hp = cfg->g_config.c_hostname;
10081031 } else {
1009 if ((hp = priv_gethostbyname()) == NULL)
1032 if ((hp = priv_gethostname()) == NULL)
10101033 fatal("localchassis", "failed to get system name");
10111034 }
10121035 free(LOCAL_CHASSIS(cfg)->c_name);
11111134 {
11121135 struct lldpd_hardware *hardware, *hardware_next;
11131136 log_debug("main", "exit lldpd");
1137
1138 TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries)
1139 lldpd_send_shutdown(hardware);
1140
11141141 close(cfg->g_ctl);
11151142 priv_ctl_cleanup(cfg->g_ctlname);
11161143 log_debug("main", "cleanup hardware information");
12831310 int ch, debug = 0;
12841311 #ifdef USE_SNMP
12851312 int snmp = 0;
1286 char *agentx = NULL; /* AgentX socket */
1287 #endif
1288 char *ctlname = LLDPD_CTL_SOCKET;
1313 const char *agentx = NULL; /* AgentX socket */
1314 #endif
1315 const char *ctlname = NULL;
12891316 char *mgmtp = NULL;
12901317 char *cidp = NULL;
12911318 char *interfaces = NULL;
13071334 int receiveonly = 0;
13081335 int ctl;
13091336
1337 #ifdef ENABLE_PRIVSEP
13101338 /* Non privileged user */
13111339 struct passwd *user;
13121340 struct group *group;
13131341 uid_t uid;
13141342 gid_t gid;
1343 #endif
13151344
13161345 saved_argv = argv;
13171346
13521381 fprintf(stderr, "-m can only be used once\n");
13531382 usage();
13541383 }
1355 mgmtp = optarg;
1384 mgmtp = strdup(optarg);
13561385 break;
13571386 case 'u':
13581387 if (ctlname) {
13661395 fprintf(stderr, "-I can only be used once\n");
13671396 usage();
13681397 }
1369 interfaces = optarg;
1398 interfaces = strdup(optarg);
13701399 break;
13711400 case 'C':
13721401 if (cidp) {
13731402 fprintf(stderr, "-C can only be used once\n");
13741403 usage();
13751404 }
1376 cidp = optarg;
1405 cidp = strdup(optarg);
13771406 break;
13781407 case 'L':
13791408 if (strlen(optarg)) lldpcli = optarg;
14491478 }
14501479 }
14511480
1481 if (ctlname == NULL) ctlname = LLDPD_CTL_SOCKET;
1482
14521483 /* Set correct smart mode */
14531484 for (i=0; (filters[i].a != -1) && (filters[i].a != smart); i++);
14541485 if (filters[i].a == -1) {
14631494 log_debug("main", "lldpd starting...");
14641495
14651496 /* Grab uid and gid to use for priv sep */
1497 #ifdef ENABLE_PRIVSEP
14661498 if ((user = getpwnam(PRIVSEP_USER)) == NULL)
14671499 fatal("main", "no " PRIVSEP_USER " user for privilege separation");
14681500 uid = user->pw_uid;
14691501 if ((group = getgrnam(PRIVSEP_GROUP)) == NULL)
14701502 fatal("main", "no " PRIVSEP_GROUP " group for privilege separation");
14711503 gid = group->gr_gid;
1504 #endif
14721505
14731506 /* Create and setup socket */
14741507 int retry = 1;
14831516 /* Another instance is running */
14841517 close(tfd);
14851518 log_warnx("main", "another instance is running, please stop it");
1486 fatalx("giving up");
1519 fatalx("main", "giving up");
14871520 } else if (errno == ECONNREFUSED) {
14881521 /* Nobody is listening */
14891522 log_info("main", "old control socket is present, clean it");
14911524 continue;
14921525 }
14931526 log_warn("main", "cannot determine if another daemon is already running");
1494 fatalx("giving up");
1527 fatalx("main", "giving up");
14951528 }
14961529 log_warn("main", "unable to create control socket");
1497 fatalx("giving up");
1498 }
1530 fatalx("main", "giving up");
1531 }
1532 #ifdef ENABLE_PRIVSEP
14991533 if (chown(ctlname, uid, gid) == -1)
15001534 log_warn("main", "unable to chown control socket");
15011535 if (chmod(ctlname,
15021536 S_IRUSR | S_IWUSR | S_IXUSR |
15031537 S_IRGRP | S_IWGRP | S_IXGRP) == -1)
15041538 log_warn("main", "unable to chmod control socket");
1539 #endif
15051540
15061541 /* Disable SIGPIPE */
15071542 signal(SIGPIPE, SIG_IGN);
15461581 }
15471582
15481583 log_debug("main", "initialize privilege separation");
1584 #ifdef ENABLE_PRIVSEP
15491585 priv_init(PRIVSEP_CHROOT, ctl, uid, gid);
1586 #else
1587 priv_init(PRIVSEP_CHROOT, ctl, 0, 0);
1588 #endif
15501589
15511590 /* Initialization of global configuration */
15521591 if ((cfg = (struct lldpd *)
112112 int g_snmp;
113113 struct event *g_snmp_timeout;
114114 void *g_snmp_fds;
115 char *g_snmp_agentx;
115 const char *g_snmp_agentx;
116116 #endif /* USE_SNMP */
117117
118118 /* Unix socket handling */
119119 const char *g_ctlname;
120120 int g_ctl;
121 struct event *g_ctl_event;
122121 struct event *g_iface_event; /* Triggered when there is an interface change */
123122 struct event *g_iface_timer_event; /* Triggered one second after last interface change */
124123
157156 void levent_schedule_pdu(struct lldpd_hardware *);
158157 void levent_schedule_cleanup(struct lldpd *);
159158 int levent_make_socket_nonblocking(int);
159 int levent_make_socket_blocking(int);
160160
161161 /* lldp.c */
162 int lldp_send_shutdown(PROTO_SEND_SIG);
162163 int lldp_send(PROTO_SEND_SIG);
163164 int lldp_decode(PROTO_DECODE_SIG);
164165
201202 #ifdef USE_SNMP
202203 /* agent.c */
203204 void agent_shutdown(void);
204 void agent_init(struct lldpd *, char *);
205 void agent_init(struct lldpd *, const char *);
205206 void agent_notify(struct lldpd_hardware *, int, struct lldpd_port *);
206207 #endif
207208
222223 void priv_init(const char*, int, uid_t, gid_t);
223224 void priv_wait(void);
224225 void priv_ctl_cleanup(const char *ctlname);
225 char *priv_gethostbyname(void);
226 char *priv_gethostname(void);
226227 #ifdef HOST_OS_LINUX
227228 int priv_open(char*);
228229 void asroot_open(void);
266267 void must_write(enum priv_context, const void *, size_t);
267268 void priv_privileged_fd(int);
268269 void priv_unprivileged_fd(int);
270 int priv_fd(enum priv_context);
269271 int receive_fd(enum priv_context);
270272 void send_fd(enum priv_context, int);
271273
3737 must_write(PRIV_UNPRIVILEGED, &cmd, sizeof(enum priv_cmd));
3838 len = strlen(file);
3939 must_write(PRIV_UNPRIVILEGED, &len, sizeof(int));
40 must_write(PRIV_UNPRIVILEGED, file, len + 1);
40 must_write(PRIV_UNPRIVILEGED, file, len);
4141 priv_wait();
4242 must_read(PRIV_UNPRIVILEGED, &rc, sizeof(int));
4343 if (rc == -1)
5454 must_write(PRIV_UNPRIVILEGED, &cmd, sizeof(enum priv_cmd));
5555 len = strlen(ifname);
5656 must_write(PRIV_UNPRIVILEGED, &len, sizeof(int));
57 must_write(PRIV_UNPRIVILEGED, ifname, len + 1);
57 must_write(PRIV_UNPRIVILEGED, ifname, len);
5858 priv_wait();
5959 must_read(PRIV_UNPRIVILEGED, &rc, sizeof(int));
6060 if (rc != 0)
7878
7979 /* Kill children and exit */
8080 kill(monitored, SIGTERM);
81 fatalx("invalid syscall not allowed: stop here");
81 fatalx("seccomp", "invalid syscall not allowed: stop here");
8282 _exit(161);
8383 }
8484
3434 #include <grp.h>
3535 #include <sys/utsname.h>
3636 #include <sys/ioctl.h>
37 #include <netdb.h>
3837 #include <netinet/if_ether.h>
3938
4039 #if defined HOST_OS_FREEBSD || HOST_OS_OSX || HOST_OS_DRAGONFLY
9594 must_read(PRIV_UNPRIVILEGED, &rc, sizeof(int));
9695 }
9796
98 /* Proxy for gethostbyname */
97 /* Proxy for gethostname */
9998 char *
100 priv_gethostbyname()
99 priv_gethostname()
101100 {
102101 static char *buf = NULL;
103102 int rc;
107106 must_read(PRIV_UNPRIVILEGED, &rc, sizeof(int));
108107 if ((buf = (char*)realloc(buf, rc+1)) == NULL)
109108 fatal("privsep", NULL);
110 must_read(PRIV_UNPRIVILEGED, buf, rc+1);
109 must_read(PRIV_UNPRIVILEGED, buf, rc);
110 buf[rc] = '\0';
111111 return buf;
112112 }
113113
212212 }
213213
214214 static void
215 asroot_gethostbyname()
215 asroot_gethostname()
216216 {
217217 struct utsname un;
218 struct hostent *hp;
218 struct addrinfo hints = {
219 .ai_flags = AI_CANONNAME
220 };
221 struct addrinfo *res;
219222 int len;
220223 if (uname(&un) < 0)
221224 fatal("privsep", "failed to get system information");
222 if ((hp = gethostbyname(un.nodename)) == NULL) {
225 if (getaddrinfo(un.nodename, NULL, &hints, &res) != 0) {
223226 log_info("privsep", "unable to get system name");
224227 #ifdef HAVE_RES_INIT
225228 res_init();
226229 #endif
227230 len = strlen(un.nodename);
228231 must_write(PRIV_PRIVILEGED, &len, sizeof(int));
229 must_write(PRIV_PRIVILEGED, un.nodename, len + 1);
232 must_write(PRIV_PRIVILEGED, un.nodename, len);
230233 } else {
231 len = strlen(hp->h_name);
234 len = strlen(res->ai_canonname);
232235 must_write(PRIV_PRIVILEGED, &len, sizeof(int));
233 must_write(PRIV_PRIVILEGED, hp->h_name, len + 1);
236 must_write(PRIV_PRIVILEGED, res->ai_canonname, len);
237 freeaddrinfo(res);
234238 }
235239 }
236240
379383 static struct dispatch_actions actions[] = {
380384 {PRIV_PING, asroot_ping},
381385 {PRIV_DELETE_CTL_SOCKET, asroot_ctl_cleanup},
382 {PRIV_GET_HOSTNAME, asroot_gethostbyname},
386 {PRIV_GET_HOSTNAME, asroot_gethostname},
383387 #ifdef HOST_OS_LINUX
384388 {PRIV_OPEN, asroot_open},
385389 {PRIV_ETHTOOL, asroot_ethtool},
407411 #endif
408412 #endif
409413 while (!may_read(PRIV_PRIVILEGED, &cmd, sizeof(enum priv_cmd))) {
414 log_debug("privsep", "received command %d", cmd);
410415 for (a = actions; a->function != NULL; a++) {
411416 if (cmd == a->msg) {
412417 a->function();
414419 }
415420 }
416421 if (a->function == NULL)
417 fatal("privsep", "bogus message received");
422 fatalx("privsep", "bogus message received");
418423 if (once) break;
419424 }
420425 }
436441 priv_exit_rc_status(int rc, int status) {
437442 switch (rc) {
438443 case 0:
439 log_debug("privsep", "killing child");
444 /* kill child */
440445 kill(monitored, SIGTERM);
441 log_debug("privsep", "waiting for child %d to terminate", monitored);
446 /* we will receive a sigchld in the future */
442447 return;
443448 case -1:
444 log_debug("privsep", "child does not exist anymore");
445 _exit(1); /* We consider this is an error to be here */
449 /* child doesn't exist anymore, we consider this is an error to
450 * be here */
451 _exit(1);
446452 break;
447453 default:
448 log_debug("privsep", "monitored child has terminated");
454 /* Monitored child has terminated */
449455 /* Mimic the exit state of the child */
450456 if (WIFEXITED(status)) {
451 log_debug("privsep", "monitored child has terminated with status %d",
452 WEXITSTATUS(status));
457 /* Normal exit */
453458 _exit(WEXITSTATUS(status));
454459 }
455460 if (WIFSIGNALED(status)) {
456 log_debug("privsep", "monitored child has terminated with signal %d",
457 WTERMSIG(status));
461 /* Terminated with signal */
458462 signal(WTERMSIG(status), SIG_DFL);
459463 raise(WTERMSIG(status));
460464 _exit(1); /* We consider that not being killed is an error. */
493497 if (rc == 0) {
494498 while ((rc = waitpid(-1, &status, WNOHANG)) > 0) {
495499 if (rc == monitored) priv_exit_rc_status(rc, status);
496 else log_debug("privsep", "unrelated process %d has died",
497 rc);
498500 }
499501 return;
500502 }
587589 int pair[2];
588590
589591 /* Create socket pair */
590 if (socketpair(AF_UNIX, SOCK_DGRAM, PF_UNSPEC, pair) < 0)
591 fatal("privsep", "unable to create socket pair for privilege separation");
592 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) < 0) {
593 fatal("privsep",
594 "unable to create socket pair for privilege separation");
595 }
592596
593597 priv_unprivileged_fd(pair[0]);
594598 priv_privileged_fd(pair[1]);
2525 {
2626 unprivileged = fd;
2727 }
28 static int
28 int
2929 priv_fd(enum priv_context ctx)
3030 {
3131 switch (ctx) {
0 AM_CFLAGS = -I $(top_srcdir)/include
0 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
1 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
2 AM_LDFLAGS = $(LLDP_LDFLAGS)
13
24 lib_LTLIBRARIES = liblldpctl.la
35 include_HEADERS = lldpctl.h
79
810 liblldpctl_la_SOURCES = lldpctl.h private.h errors.c connection.c atom.c atom-private.c
911 liblldpctl_la_LIBADD = $(top_builddir)/src/libcommon-daemon-lib.la libfixedpoint.la
10 liblldpctl_la_LDFLAGS = -export-symbols-regex '^lldpctl_' -version-info 7:0:3
12 liblldpctl_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^lldpctl_' -version-info 9:0:5
1113
1214 # -version-info format is `current`:`revision`:`age`. For more details, see:
1315 # http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
1416
15 pkgconfigdir = $(libdir)/pkgconfig
1617 pkgconfig_DATA = lldpctl.pc
1718
1819 TEMPLATES = lldpctl.pc
290290 LIPO = @LIPO@
291291 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
292292 LLDPD_PID_FILE = @LLDPD_PID_FILE@
293 LLDP_CFLAGS = @LLDP_CFLAGS@
294 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
295 LLDP_LDFLAGS = @LLDP_LDFLAGS@
293296 LN_S = @LN_S@
294297 LTLIBOBJS = @LTLIBOBJS@
295298 MAINT = @MAINT@
376379 mkdir_p = @mkdir_p@
377380 oldincludedir = @oldincludedir@
378381 pdfdir = @pdfdir@
382 pkgconfigdir = @pkgconfigdir@
379383 prefix = @prefix@
380384 program_transform_name = @program_transform_name@
381385 psdir = @psdir@
391395 top_build_prefix = @top_build_prefix@
392396 top_builddir = @top_builddir@
393397 top_srcdir = @top_srcdir@
394 AM_CFLAGS = -I $(top_srcdir)/include
398 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
399 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
400 AM_LDFLAGS = $(LLDP_LDFLAGS)
395401 lib_LTLIBRARIES = liblldpctl.la
396402 include_HEADERS = lldpctl.h
397403 noinst_LTLIBRARIES = libfixedpoint.la
398404 libfixedpoint_la_SOURCES = fixedpoint.h fixedpoint.c
399405 liblldpctl_la_SOURCES = lldpctl.h private.h errors.c connection.c atom.c atom-private.c
400406 liblldpctl_la_LIBADD = $(top_builddir)/src/libcommon-daemon-lib.la libfixedpoint.la
401 liblldpctl_la_LDFLAGS = -export-symbols-regex '^lldpctl_' -version-info 7:0:3
407 liblldpctl_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^lldpctl_' -version-info 9:0:5
402408
403409 # -version-info format is `current`:`revision`:`age`. For more details, see:
404410 # http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
405 pkgconfigdir = $(libdir)/pkgconfig
406411 pkgconfig_DATA = lldpctl.pc
407412 TEMPLATES = lldpctl.pc
408413 EXTRA_DIST = lldpctl.pc.in
409414 CLEANFILES = $(TEMPLATES)
410415 edit = $(SED) \
411416 -e 's|@bindir[@]|$(bindir)|g' \
417 -e 's|@sbindir[@]|$(sbindir)|g' \
412418 -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
413419 -e 's|@libdir[@]|$(libdir)|g' \
414420 -e 's|@includedir[@]|$(includedir)|g' \
805811 lldpctl.pc: lldpctl.pc.in
806812
807813 $(TEMPLATES): Makefile
808 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp
809 mv $@.tmp $@
814 $(AM_V_GEN)$(edit) $(srcdir)/$@.in > $@.tmp && mv $@.tmp $@
810815
811816 # Tell versions [3.59,3.63) of GNU make to not export all variables.
812817 # Otherwise a system limit (for SysV at least) may be exceeded.
148148 { LLDP_DOT3_POWER_SOURCE_PRIMARY, "Primary power source" },
149149 { 0, NULL }
150150 };
151
151 #endif
152
153 #if defined ENABLE_DOT3 || defined ENABLE_LLDPMED
152154 static lldpctl_map_t port_dot3_power_priority_map[] = {
153155 { 0, "unknown" },
154156 { LLDP_MED_POW_PRIO_CRITICAL, "critical" },
270272 static lldpctl_map_t lldp_portid_map[] = {
271273 { LLDP_PORTID_SUBTYPE_IFNAME, "ifname"},
272274 { LLDP_PORTID_SUBTYPE_LLADDR, "macaddress"},
275 { LLDP_PORTID_SUBTYPE_LOCAL, "local"},
273276 { LLDP_PORTID_SUBTYPE_UNKNOWN, NULL},
274277 };
275278
292295 static int
293296 map_reverse_lookup(lldpctl_map_t *list, const char *string)
294297 {
295 unsigned int i;
296
297 for (i = 0; list[i].string != NULL; i++) {
298 if (!string) return -1;
299
300 for (unsigned int i = 0; list[i].string != NULL; i++) {
298301 if (!strcasecmp(list[i].string, string))
299302 return list[i].value;
300303 }
391394 return res?res:"";
392395 }
393396
397 static struct _lldpctl_atom_config_t*
398 __lldpctl_atom_set_str_config(struct _lldpctl_atom_config_t *c,
399 char **local, char **global,
400 const char *value) {
401 if (value) {
402 char *aval = NULL;
403 size_t len = strlen(value) + 1;
404 aval = _lldpctl_alloc_in_atom((lldpctl_atom_t *)c, len);
405 if (!aval) return NULL;
406 memcpy(aval, value, len);
407 *local = aval;
408 free(*global); *global = strdup(aval);
409 } else {
410 free(*global);
411 *local = *global = NULL;
412 }
413 return c;
414 }
415
394416 static lldpctl_atom_t*
395417 _lldpctl_atom_set_str_config(lldpctl_atom_t *atom, lldpctl_key_t key,
396418 const char *value)
397419 {
398420 struct _lldpctl_atom_config_t *c =
399421 (struct _lldpctl_atom_config_t *)atom;
400 struct lldpd_config config = {};
401 char *iface_pattern = NULL, *mgmt_pattern = NULL;
402 char *description = NULL;
422 struct lldpd_config config;
423 memcpy(&config, c->config, sizeof(struct lldpd_config));
403424 char *canary = NULL;
404 int rc, len;
405
406 len = strlen(value) + 1;
425 int rc;
407426
408427 switch (key) {
409428 case lldpctl_k_config_iface_pattern:
410 iface_pattern = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
411 if (!iface_pattern)
429 if (!__lldpctl_atom_set_str_config(c,
430 &config.c_iface_pattern, &c->config->c_iface_pattern,
431 value))
412432 return NULL;
413 memcpy(iface_pattern, value, len);
414 config.c_iface_pattern = iface_pattern;
415 free(c->config->c_iface_pattern);
416 c->config->c_iface_pattern = strdup(iface_pattern);
417433 break;
418434 case lldpctl_k_config_mgmt_pattern:
419 mgmt_pattern = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
420 if (!mgmt_pattern)
435 if (!__lldpctl_atom_set_str_config(c,
436 &config.c_mgmt_pattern, &c->config->c_mgmt_pattern,
437 value))
421438 return NULL;
422 memcpy(mgmt_pattern, value, len);
423 config.c_mgmt_pattern = mgmt_pattern;
424 free(c->config->c_mgmt_pattern);
425 c->config->c_mgmt_pattern = strdup(mgmt_pattern);
426439 break;
427440 case lldpctl_k_config_description:
428 description = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
429 if (!description)
441 if (!__lldpctl_atom_set_str_config(c,
442 &config.c_description, &c->config->c_description,
443 value))
430444 return NULL;
431 memcpy(description, value, len);
432 config.c_description = description;
433 free(c->config->c_description);
434 c->config->c_description = strdup(description);
435445 break;
436446 case lldpctl_k_config_platform:
437 description = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
438 if (!description)
447 if (!__lldpctl_atom_set_str_config(c,
448 &config.c_platform, &c->config->c_platform,
449 value))
439450 return NULL;
440 memcpy(description, value, len);
441 config.c_platform = description;
442 free(c->config->c_platform);
443 c->config->c_description = strdup(description);
444451 break;
445452 case lldpctl_k_config_hostname:
446 description = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
447 if (!description)
453 if (!__lldpctl_atom_set_str_config(c,
454 &config.c_hostname, &c->config->c_hostname,
455 value))
448456 return NULL;
449 memcpy(description, value, len);
450 config.c_hostname = description;
451 free(c->config->c_hostname);
452 c->config->c_hostname = strdup(description);
453457 break;
454458 default:
455459 SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
456460 return NULL;
457461 }
458462
459 if (asprintf(&canary, "%d%s", key, value) == -1) {
463 if (asprintf(&canary, "%d%s", key, value?value:"(NULL)") == -1) {
460464 SET_ERROR(atom->conn, LLDPCTL_ERR_NOMEM);
461465 return NULL;
462466 }
467471 NULL, NULL);
468472 free(canary);
469473 if (rc == 0) return atom;
474
475 #undef SET_STR
470476
471477 return NULL;
472478 }
512518 char *canary = NULL;
513519 struct _lldpctl_atom_config_t *c =
514520 (struct _lldpctl_atom_config_t *)atom;
515 struct lldpd_config config = {};
521 struct lldpd_config config;
522 memcpy(&config, c->config, sizeof(struct lldpd_config));
516523
517524 switch (key) {
518525 case lldpctl_k_config_paused:
530537 break;
531538 #ifdef ENABLE_LLDPMED
532539 case lldpctl_k_config_fast_start_enabled:
533 config.c_enable_fast_start = value?1:2;
534 c->config->c_enable_fast_start = value;
540 config.c_enable_fast_start = c->config->c_enable_fast_start = value;
535541 break;
536542 case lldpctl_k_config_fast_start_interval:
537543 config.c_tx_fast_interval = c->config->c_tx_fast_interval = value;
838844 }
839845
840846 switch (key) {
847 case lldpctl_k_port_id:
848 set.local_id = p->port->p_id;
849 break;
850 case lldpctl_k_port_descr:
851 set.local_descr = p->port->p_descr;
852 break;
841853 #ifdef ENABLE_DOT3
842854 case lldpctl_k_port_dot3_power:
843855 if (value->type != atom_dot3_power) {
10171029 SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
10181030 return NULL;
10191031 }
1032 }
1033
1034 static lldpctl_atom_t*
1035 _lldpctl_atom_set_str_port(lldpctl_atom_t *atom, lldpctl_key_t key,
1036 const char *value)
1037 {
1038 struct _lldpctl_atom_port_t *p =
1039 (struct _lldpctl_atom_port_t *)atom;
1040 struct lldpd_port *port = p->port;
1041
1042 if (!value || !strlen(value))
1043 return NULL;
1044
1045 switch (key) {
1046 case lldpctl_k_port_id:
1047 free(port->p_id);
1048 port->p_id = strdup(value);
1049 port->p_id_len = strlen(value);
1050 break;
1051 case lldpctl_k_port_descr:
1052 free(port->p_descr);
1053 port->p_descr = strdup(value);
1054 break;
1055 default:
1056 SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
1057 return NULL;
1058 }
1059
1060 return _lldpctl_atom_set_atom_port(atom, key, NULL);
10201061 }
10211062
10221063 static long int
18991940 case 0: /* Disabling */
19001941 case LLDP_MED_LOCFORMAT_COORD:
19011942 mloc->location->format = value;
1902 if (mloc->location->data) free(mloc->location->data);
1943 free(mloc->location->data);
19031944 mloc->location->data = calloc(1, 16);
19041945 if (mloc->location->data == NULL) {
19051946 mloc->location->data_len = 0;
19101951 return atom;
19111952 case LLDP_MED_LOCFORMAT_CIVIC:
19121953 mloc->location->format = value;
1913 if (mloc->location->data) free(mloc->location->data);
1954 free(mloc->location->data);
19141955 mloc->location->data = calloc(1, 4);
19151956 if (mloc->location->data == NULL) {
19161957 mloc->location->data_len = 0;
19251966 return atom;
19261967 case LLDP_MED_LOCFORMAT_ELIN:
19271968 mloc->location->format = value;
1928 if (mloc->location->data) free(mloc->location->data);
1969 free(mloc->location->data);
19291970 mloc->location->data = NULL;
19301971 mloc->location->data_len = 0;
19311972 return atom;
20532094 struct _lldpctl_atom_med_location_t *mloc =
20542095 (struct _lldpctl_atom_med_location_t *)atom;
20552096 struct fp_number fp;
2056 char *end;
2097 char *end = NULL;
20572098
20582099 /* Only local port can be modified */
20592100 if (mloc->parent->hardware == NULL) {
20652106 case lldpctl_k_med_location_latitude:
20662107 if (mloc->location->format != LLDP_MED_LOCFORMAT_COORD) goto bad;
20672108 if (mloc->location->data == NULL || mloc->location->data_len != 16) goto bad;
2068 fp = fp_strtofp(value, &end, 9, 25);
2109 if (value) fp = fp_strtofp(value, &end, 9, 25);
20692110 if (!end) goto bad;
20702111 if (end && *end != '\0') {
20712112 if (*(end+1) != '\0') goto bad;
20772118 case lldpctl_k_med_location_longitude:
20782119 if (mloc->location->format != LLDP_MED_LOCFORMAT_COORD) goto bad;
20792120 if (mloc->location->data == NULL || mloc->location->data_len != 16) goto bad;
2080 fp = fp_strtofp(value, &end, 9, 25);
2121 if (value) fp = fp_strtofp(value, &end, 9, 25);
20812122 if (!end) goto bad;
20822123 if (end && *end != '\0') {
20832124 if (*(end+1) != '\0') goto bad;
20892130 case lldpctl_k_med_location_altitude:
20902131 if (mloc->location->format != LLDP_MED_LOCFORMAT_COORD) goto bad;
20912132 if (mloc->location->data == NULL || mloc->location->data_len != 16) goto bad;
2092 fp = fp_strtofp(value, &end, 22, 8);
2133 if (value) fp = fp_strtofp(value, &end, 22, 8);
20932134 if (!end || *end != '\0') goto bad;
20942135 fp_fptobuf(fp, (unsigned char*)mloc->location->data, 84);
20952136 return atom;
20962137 case lldpctl_k_med_location_altitude_unit:
2138 if (!value) goto bad;
20972139 if (mloc->location->format != LLDP_MED_LOCFORMAT_COORD) goto bad;
20982140 if (mloc->location->data == NULL || mloc->location->data_len != 16) goto bad;
20992141 if (!strcmp(value, "m"))
21042146 return _lldpctl_atom_set_int_med_location(atom, key,
21052147 LLDP_MED_LOCATION_ALTITUDE_UNIT_FLOOR);
21062148 goto bad;
2149 break;
21072150 case lldpctl_k_med_location_geoid:
21082151 return _lldpctl_atom_set_int_med_location(atom, key,
21092152 map_reverse_lookup(port_med_geoid_map, value));
21102153 case lldpctl_k_med_location_country:
21112154 if (mloc->location->format != LLDP_MED_LOCFORMAT_CIVIC) goto bad;
21122155 if (mloc->location->data == NULL || mloc->location->data_len < 3) goto bad;
2113 if (strlen(value) != 2) goto bad;
2156 if (!value || strlen(value) != 2) goto bad;
21142157 memcpy(mloc->location->data + 2, value, 2);
21152158 return atom;
21162159 case lldpctl_k_med_location_elin:
2160 if (!value) goto bad;
21172161 if (mloc->location->format != LLDP_MED_LOCFORMAT_ELIN) goto bad;
2118 if (mloc->location->data) free(mloc->location->data);
2162 free(mloc->location->data);
21192163 mloc->location->data = calloc(1, strlen(value));
21202164 if (mloc->location->data == NULL) {
21212165 mloc->location->data_len = 0;
23622406
23632407 switch (key) {
23642408 case lldpctl_k_med_civicaddress_value:
2409 if (!value) goto bad;
23652410 len = strlen(value) + 1;
23662411 if (len > 251) goto bad;
23672412 el->value = _lldpctl_alloc_in_atom(atom, len);
25832628 .get = _lldpctl_atom_get_atom_port,
25842629 .set = _lldpctl_atom_set_atom_port,
25852630 .get_str = _lldpctl_atom_get_str_port,
2631 .set_str = _lldpctl_atom_set_str_port,
25862632 .get_int = _lldpctl_atom_get_int_port,
25872633 .get_buffer = _lldpctl_atom_get_buf_port },
25882634 { atom_mgmts_list, sizeof(struct _lldpctl_atom_mgmts_list_t),
135135 {
136136 lldpctl_atom_t *result = NULL;
137137 char *end;
138 long int converted;
139 int isint;
138 long int converted = 0;
139 int isint = 0;
140140 int bad = 0;
141141
142142 if (atom == NULL) return NULL;
151151 bad = bad || (lldpctl_last_error(atom->conn) == LLDPCTL_ERR_BAD_VALUE);
152152 }
153153
154 converted = strtol(value, &end, 0);
155 isint = (end != value && *end == '\0');
154 if (value) {
155 converted = strtol(value, &end, 0);
156 isint = (end != value && *end == '\0');
157 }
156158
157159 RESET_ERROR(atom->conn);
158160 if (atom->set_int != NULL && isint) {
166168
167169 RESET_ERROR(atom->conn);
168170 if (atom->set_buffer != NULL) {
169 result = atom->set_buffer(atom, key, (u_int8_t*)value, strlen(value));
171 result = atom->set_buffer(atom, key, (u_int8_t*)value, value?strlen(value):0);
170172 if (result) return result;
171173 if (lldpctl_last_error(atom->conn) != LLDPCTL_ERR_NOT_EXIST &&
172174 lldpctl_last_error(atom->conn) != LLDPCTL_ERR_BAD_VALUE)
574574 * LLDPCTL_ERR_WOULDBLOCK, you need to try again later. Usually, changes are
575575 * transmitted immediatly. The exception are changes that need to be grouped to
576576 * be consistent, like a LLDP MED location. When a change is transmitted
577 * immediatly, it is marked with (O).
577 * immediatly, it is marked with (O). @c lldpctl_atom_set_str() may accept a @c
578 * NULL value. This case is marked with (N) and usually reset the item to the
579 * default value or no value.
578580 *
579581 * Some values may also be created. They are flagged with (C). This only applies
580582 * to elements that can be iterated (L) and written (W). The element created
596598 typedef enum {
597599 lldpctl_k_config_tx_interval, /**< `(I,WO)` Transmit interval. When set to -1, it is meant to transmit now. */
598600 lldpctl_k_config_receiveonly, /**< `(I)` Receive only mode */
599 lldpctl_k_config_mgmt_pattern, /**< `(S)` Pattern to choose the management address */
600 lldpctl_k_config_iface_pattern, /**< `(S,WO)` Pattern of enabled interfaces */
601 lldpctl_k_config_mgmt_pattern, /**< `(S,WON)` Pattern to choose the management address */
602 lldpctl_k_config_iface_pattern, /**< `(S,WON)` Pattern of enabled interfaces */
601603 lldpctl_k_config_cid_pattern, /**< `(S)` Interface pattern to choose the chassis ID */
602 lldpctl_k_config_description, /**< `(S,WO)` Chassis description overridden */
603 lldpctl_k_config_platform, /**< `(S,WO)` Platform description overridden (CDP) */
604 lldpctl_k_config_hostname, /**< `(S,WO)` System name overridden */
604 lldpctl_k_config_description, /**< `(S,WON)` Chassis description overridden */
605 lldpctl_k_config_platform, /**< `(S,WON)` Platform description overridden (CDP) */
606 lldpctl_k_config_hostname, /**< `(S,WON)` System name overridden */
605607 lldpctl_k_config_advertise_version, /**< `(I)` Advertise version */
606608 lldpctl_k_config_lldpmed_noinventory, /**< `(I)` Disable LLDP-MED inventory */
607609 lldpctl_k_config_paused, /**< `(I)` lldpd is paused */
623625 lldpctl_k_port_protocol, /**< `(IS)` The protocol that was used to retrieve this information. */
624626 lldpctl_k_port_age, /**< `(I)` Age of information, seconds from epoch. */
625627 lldpctl_k_port_id_subtype, /**< `(IS)` The subtype ID of this port. */
626 lldpctl_k_port_id, /**< `(BS)` The ID of this port. */
627 lldpctl_k_port_descr, /**< `(S)` The description of this port. */
628 lldpctl_k_port_id, /**< `(BS,WO)` The ID of this port. */
629 lldpctl_k_port_descr, /**< `(S,WO)` The description of this port. */
628630 lldpctl_k_port_hidden, /**< `(I)` Is this port hidden (or should it be displayed?)? */
629631
630632 lldpctl_k_port_dot3_mfs = 1300, /**< `(I)` MFS */
11 Description: Library to interface with lldpd, a 802.1AB daemon
22 Version: @VERSION@
33 URL: @PACKAGE_URL@
4 Libs: -L${libdir} -llldpctl
5 Cflags: -I${includedir}
4 Libs: -L@libdir@ -llldpctl
5 Cflags: -I@includedir@
2626 struct lldpd_mgmt *mgmt, *mgmt_next;
2727
2828 log_debug("alloc", "cleanup management addresses for chassis %s",
29 chassis->c_name ? chassis->c_name : "(unknwon)");
29 chassis->c_name ? chassis->c_name : "(unknown)");
3030
3131 for (mgmt = TAILQ_FIRST(&chassis->c_mgmt);
3232 mgmt != NULL;
4242 {
4343 lldpd_chassis_mgmt_cleanup(chassis);
4444 log_debug("alloc", "cleanup chassis %s",
45 chassis->c_name ? chassis->c_name : "(unknwon)");
45 chassis->c_name ? chassis->c_name : "(unknown)");
4646 #ifdef ENABLE_LLDPMED
4747 free(chassis->c_med_hw);
4848 free(chassis->c_med_sw);
160160 #endif
161161 /* will set these to NULL so we don't free wrong memory */
162162
163 free(port->p_id);
164 port->p_id = NULL;
165 free(port->p_descr);
166 port->p_descr = NULL;
167163 if (all) {
164 free(port->p_id);
165 port->p_id = NULL;
166 free(port->p_descr);
167 port->p_descr = NULL;
168168 free(port->p_lastframe);
169169 if (port->p_chassis) { /* chassis may not have been attributed, yet */
170170 port->p_chassis->c_refcount--;
224224 u_int8_t p_hidden_in:1; /* Considered as hidden for reception */
225225 u_int8_t p_hidden_out:2; /* Considered as hidden for emission */
226226 /* Important: all fields that should be ignored to check if a port has
227 * been changed should be before p_id_subtype. Check
228 * `lldpd_reset_timer()`. */
227 * been changed should be before this mark. */
228 #define LLDPD_PORT_START_MARKER (offsetof(struct lldpd_port, p_id_subtype))
229229 u_int8_t p_id_subtype;
230230 char *p_id;
231231 int p_id_len;
274274 /* Used to modify some port related settings */
275275 struct lldpd_port_set {
276276 char *ifname;
277 char *local_id;
278 char *local_descr;
277279 #ifdef ENABLE_LLDPMED
278280 struct lldpd_med_policy *med_policy;
279281 struct lldpd_med_loc *med_location;
285287 };
286288 MARSHAL_BEGIN(lldpd_port_set)
287289 MARSHAL_STR(lldpd_port_set, ifname)
290 MARSHAL_STR(lldpd_port_set, local_id)
291 MARSHAL_STR(lldpd_port_set, local_descr)
288292 #ifdef ENABLE_LLDPMED
289293 MARSHAL_POINTER(lldpd_port_set, lldpd_med_policy, med_policy)
290294 MARSHAL_POINTER(lldpd_port_set, lldpd_med_loc, med_location)
397401 u_int64_t h_delete_cnt;
398402 u_int64_t h_drop_cnt;
399403
400 u_int16_t h_lport_cksum; /* Checksum on local port to see if there is a change */
404 /* Previous values of different stuff. */
405 /* Backup of the previous local port. Used to check if there was a
406 * change to send an immediate update. All those are not marshalled to
407 * the client. */
408 void *h_lport_previous;
409 ssize_t h_lport_previous_len;
410 /* Backup of the previous chassis ID. Used to check if there was a
411 * change and send an LLDP shutdown. */
412 u_int8_t h_lchassis_previous_id_subtype;
413 char *h_lchassis_previous_id;
414 int h_lchassis_previous_id_len;
415 /* Backup of the previous port ID. Used to check if there was a change
416 * and send an LLDP shutdown. */
417 u_int8_t h_lport_previous_id_subtype;
418 char *h_lport_previous_id;
419 int h_lport_previous_id_len;
420
401421 struct lldpd_port h_lport; /* Port attached to this hardware port */
402422 TAILQ_HEAD(, lldpd_port) h_rports; /* Remote ports */
403423
411431 MARSHAL_IGNORE(lldpd_hardware, h_ops)
412432 MARSHAL_IGNORE(lldpd_hardware, h_data)
413433 MARSHAL_IGNORE(lldpd_hardware, h_cfg)
434 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous)
435 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_len)
436 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id_subtype)
437 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id)
438 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id_len)
439 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id_subtype)
440 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id)
441 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id_len)
414442 MARSHAL_SUBSTRUCT(lldpd_hardware, lldpd_port, h_lport)
415443 MARSHAL_SUBTQ(lldpd_hardware, lldpd_port, h_rports)
416444 MARSHAL_END(lldpd_hardware);
243243 }
244244
245245 void
246 fatalx(const char *emsg)
246 fatalx(const char *token, const char *emsg)
247247 {
248248 errno = 0;
249 fatal(NULL, emsg);
250 }
249 fatal(token, emsg);
250 }
2424 void log_info(const char *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
2525 void log_debug(const char *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
2626 void fatal(const char*, const char *) __attribute__((__noreturn__));
27 void fatalx(const char *) __attribute__((__noreturn__));
27 void fatalx(const char *, const char *) __attribute__((__noreturn__));
2828
2929 void log_register(void (*cb)(int, const char*));
3030 void log_accept(const char *);
0 AM_CFLAGS = -I $(top_srcdir)/include
0 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
1 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
2 AM_LDFLAGS = $(LLDP_LDFLAGS)
13
24 if HAVE_CHECK
35
68 LDADD = $(top_builddir)/src/daemon/liblldpd.la @CHECK_LIBS@ @LIBEVENT_LDFLAGS@
79
810 check_marshal_SOURCES = check_marshal.c \
9 $(top_srcdir)/src/marshal.h
11 $(top_srcdir)/src/marshal.h \
12 check-compat.h
1013
1114 check_pattern_SOURCES = check_pattern.c \
1215 $(top_srcdir)/src/daemon/lldpd.h
1316
1417 check_lldp_SOURCES = check_lldp.c \
1518 $(top_srcdir)/src/daemon/lldpd.h \
16 common.h common.c
19 common.h common.c check-compat.h
1720
1821 check_cdp_SOURCES = check_cdp.c \
1922 $(top_srcdir)/src/daemon/lldpd.h \
20 common.h common.c
23 common.h common.c check-compat.h
2124
2225 check_sonmp_SOURCES = check_sonmp.c \
2326 $(top_srcdir)/src/daemon/lldpd.h \
24 common.h common.c
27 common.h common.c check-compat.h
2528
2629 check_edp_SOURCES = check_edp.c \
2730 $(top_srcdir)/src/daemon/lldpd.h \
28 common.h common.c
31 common.h common.c check-compat.h
2932
3033 check_fixedpoint_SOURCES = check_fixedpoint.c
3134 check_fixedpoint_LDADD = $(top_builddir)/src/lib/libfixedpoint.la $(LDADD)
115115 @HAVE_CHECK_TRUE@ check_edp$(EXEEXT) check_fixedpoint$(EXEEXT) \
116116 @HAVE_CHECK_TRUE@ $(am__EXEEXT_1)
117117 am__check_cdp_SOURCES_DIST = check_cdp.c \
118 $(top_srcdir)/src/daemon/lldpd.h common.h common.c
118 $(top_srcdir)/src/daemon/lldpd.h common.h common.c \
119 check-compat.h
119120 @HAVE_CHECK_TRUE@am_check_cdp_OBJECTS = check_cdp.$(OBJEXT) \
120121 @HAVE_CHECK_TRUE@ common.$(OBJEXT)
121122 check_cdp_OBJECTS = $(am_check_cdp_OBJECTS)
129130 am__v_lt_0 = --silent
130131 am__v_lt_1 =
131132 am__check_edp_SOURCES_DIST = check_edp.c \
132 $(top_srcdir)/src/daemon/lldpd.h common.h common.c
133 $(top_srcdir)/src/daemon/lldpd.h common.h common.c \
134 check-compat.h
133135 @HAVE_CHECK_TRUE@am_check_edp_OBJECTS = check_edp.$(OBJEXT) \
134136 @HAVE_CHECK_TRUE@ common.$(OBJEXT)
135137 check_edp_OBJECTS = $(am_check_edp_OBJECTS)
148150 @HAVE_CHECK_TRUE@ $(top_builddir)/src/lib/libfixedpoint.la \
149151 @HAVE_CHECK_TRUE@ $(am__DEPENDENCIES_2)
150152 am__check_lldp_SOURCES_DIST = check_lldp.c \
151 $(top_srcdir)/src/daemon/lldpd.h common.h common.c
153 $(top_srcdir)/src/daemon/lldpd.h common.h common.c \
154 check-compat.h
152155 @HAVE_CHECK_TRUE@am_check_lldp_OBJECTS = check_lldp.$(OBJEXT) \
153156 @HAVE_CHECK_TRUE@ common.$(OBJEXT)
154157 check_lldp_OBJECTS = $(am_check_lldp_OBJECTS)
157160 @HAVE_CHECK_TRUE@ $(top_builddir)/src/daemon/liblldpd.la \
158161 @HAVE_CHECK_TRUE@ $(am__DEPENDENCIES_1)
159162 am__check_marshal_SOURCES_DIST = check_marshal.c \
160 $(top_srcdir)/src/marshal.h
163 $(top_srcdir)/src/marshal.h check-compat.h
161164 @HAVE_CHECK_TRUE@am_check_marshal_OBJECTS = check_marshal.$(OBJEXT)
162165 check_marshal_OBJECTS = $(am_check_marshal_OBJECTS)
163166 check_marshal_LDADD = $(LDADD)
183186 @HAVE_CHECK_TRUE@ $(top_builddir)/src/daemon/liblldpd.la \
184187 @HAVE_CHECK_TRUE@ $(am__DEPENDENCIES_1)
185188 am__check_sonmp_SOURCES_DIST = check_sonmp.c \
186 $(top_srcdir)/src/daemon/lldpd.h common.h common.c
189 $(top_srcdir)/src/daemon/lldpd.h common.h common.c \
190 check-compat.h
187191 @HAVE_CHECK_TRUE@am_check_sonmp_OBJECTS = check_sonmp.$(OBJEXT) \
188192 @HAVE_CHECK_TRUE@ common.$(OBJEXT)
189193 check_sonmp_OBJECTS = $(am_check_sonmp_OBJECTS)
544548 LIPO = @LIPO@
545549 LLDPD_CTL_SOCKET = @LLDPD_CTL_SOCKET@
546550 LLDPD_PID_FILE = @LLDPD_PID_FILE@
551 LLDP_CFLAGS = @LLDP_CFLAGS@
552 LLDP_CPPFLAGS = @LLDP_CPPFLAGS@
553 LLDP_LDFLAGS = @LLDP_LDFLAGS@
547554 LN_S = @LN_S@
548555 LTLIBOBJS = @LTLIBOBJS@
549556 MAINT = @MAINT@
630637 mkdir_p = @mkdir_p@
631638 oldincludedir = @oldincludedir@
632639 pdfdir = @pdfdir@
640 pkgconfigdir = @pkgconfigdir@
633641 prefix = @prefix@
634642 program_transform_name = @program_transform_name@
635643 psdir = @psdir@
645653 top_build_prefix = @top_build_prefix@
646654 top_builddir = @top_builddir@
647655 top_srcdir = @top_srcdir@
648 AM_CFLAGS = -I $(top_srcdir)/include $(am__append_1)
656 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS) $(am__append_1)
657 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
658 AM_LDFLAGS = $(LLDP_LDFLAGS)
649659 @HAVE_CHECK_TRUE@LDADD = $(top_builddir)/src/daemon/liblldpd.la \
650660 @HAVE_CHECK_TRUE@ @CHECK_LIBS@ @LIBEVENT_LDFLAGS@ \
651661 @HAVE_CHECK_TRUE@ $(am__append_3)
652662 @HAVE_CHECK_TRUE@check_marshal_SOURCES = check_marshal.c \
653 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/marshal.h
663 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/marshal.h \
664 @HAVE_CHECK_TRUE@ check-compat.h
654665
655666 @HAVE_CHECK_TRUE@check_pattern_SOURCES = check_pattern.c \
656667 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/daemon/lldpd.h
657668
658669 @HAVE_CHECK_TRUE@check_lldp_SOURCES = check_lldp.c \
659670 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/daemon/lldpd.h \
660 @HAVE_CHECK_TRUE@ common.h common.c
671 @HAVE_CHECK_TRUE@ common.h common.c check-compat.h
661672
662673 @HAVE_CHECK_TRUE@check_cdp_SOURCES = check_cdp.c \
663674 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/daemon/lldpd.h \
664 @HAVE_CHECK_TRUE@ common.h common.c
675 @HAVE_CHECK_TRUE@ common.h common.c check-compat.h
665676
666677 @HAVE_CHECK_TRUE@check_sonmp_SOURCES = check_sonmp.c \
667678 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/daemon/lldpd.h \
668 @HAVE_CHECK_TRUE@ common.h common.c
679 @HAVE_CHECK_TRUE@ common.h common.c check-compat.h
669680
670681 @HAVE_CHECK_TRUE@check_edp_SOURCES = check_edp.c \
671682 @HAVE_CHECK_TRUE@ $(top_srcdir)/src/daemon/lldpd.h \
672 @HAVE_CHECK_TRUE@ common.h common.c
683 @HAVE_CHECK_TRUE@ common.h common.c check-compat.h
673684
674685 @HAVE_CHECK_TRUE@check_fixedpoint_SOURCES = check_fixedpoint.c
675686 @HAVE_CHECK_TRUE@check_fixedpoint_LDADD = $(top_builddir)/src/lib/libfixedpoint.la $(LDADD)
0 #ifndef _CHECK_COMPAT_H
1 #define _CHECK_COMPAT_H
2
3 #if (CHECK_MAJOR_VERSION == 0 && (CHECK_MINOR_VERSION < 9 || (CHECK_MINOR_VERSION == 9 && CHECK_MICRO_VERSION < 10)))
4 # define ck_assert_ptr_eq(X,Y) do { \
5 void* _ck_x = (X); \
6 void* _ck_y = (Y); \
7 ck_assert_msg(_ck_x == _ck_y, \
8 "Assertion '"#X"=="#Y"' failed: "#X"==%p, "#Y"==%p", \
9 _ck_x, _ck_y); \
10 } while (0)
11 #endif
12
13 #endif
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <sys/socket.h>
219 #include <arpa/inet.h>
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <sys/socket.h>
219 #include <arpa/inet.h>
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <sys/socket.h>
219 #include <arpa/inet.h>
489506 ck_assert_int_eq(nport->p_id_len, ETHER_ADDR_LEN);
490507 fail_unless(memcmp(mac2, nport->p_id, ETHER_ADDR_LEN) == 0);
491508 ck_assert_int_eq(nchassis->c_ttl, 120);
492 ck_assert_int_eq(nchassis->c_name, NULL);
493 ck_assert_int_eq(nchassis->c_descr, NULL);
494 ck_assert_int_eq(nport->p_descr, NULL);
509 ck_assert_ptr_eq(nchassis->c_name, NULL);
510 ck_assert_ptr_eq(nchassis->c_descr, NULL);
511 ck_assert_ptr_eq(nport->p_descr, NULL);
495512 }
496513 END_TEST
497514
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <unistd.h>
219 #include <check.h>
320 #include <sys/queue.h>
421
522 #define MARSHAL_EXPORT
23 #include "check-compat.h"
624 #include "../src/marshal.h"
725 #include "../src/log.h"
826
927 /* This suite can be run in valgrind for memory leaks:
1028 CK_FORK=no valgrind -v --leak-check=yes ./tests/check_marshal
1129 */
12
13 #if (CHECK_MAJOR_VERSION == 0 && (CHECK_MINOR_VERSION < 9 || (CHECK_MINOR_VERSION == 9 && CHECK_MICRO_VERSION < 10)))
14 # define ck_assert_ptr_eq(X,Y) do { \
15 void* _ck_x = (X); \
16 void* _ck_y = (Y); \
17 ck_assert_msg(_ck_x == _ck_y, \
18 "Assertion '"#X"=="#Y"' failed: "#X"==%p, "#Y"==%p", \
19 _ck_x, _ck_y); \
20 } while (0)
21 #endif
2230
2331 /* Use this callback to avoid some logs */
2432 void donothing(int pri, const char *msg) {};
497505 e2 = TAILQ_NEXT(e1, s_entries);
498506 free(e1);
499507 ck_assert_int_eq(e2->g1, 49);
500 ck_assert_int_eq(e2->g2, s);
508 ck_assert_ptr_eq(e2->g2, s);
501509 e1 = TAILQ_NEXT(e2, s_entries);
502510 free(e2);
503511 ck_assert_int_eq(e1->g1, 4700);
504 ck_assert_int_eq(e1->g2, NULL);
512 ck_assert_ptr_eq(e1->g2, NULL);
505513 e2 = TAILQ_NEXT(e1, s_entries);
506514 free(e1);
507515 ck_assert_int_eq(e2->g1, -47);
508 ck_assert_int_eq(e2->g2, s);
516 ck_assert_ptr_eq(e2->g2, s);
509517 e1 = TAILQ_NEXT(e2, s_entries);
510518 free(e2);
511 ck_assert_int_eq(e1, NULL);
519 ck_assert_ptr_eq(e1, NULL);
512520 free(s);
513521 free(destination);
514522 }
583591 e2 = TAILQ_NEXT(e1, s_entries);
584592 free(e1);
585593 ck_assert_int_eq(e2->g1, 49);
586 ck_assert_int_eq(e2->g2, s);
594 ck_assert_ptr_eq(e2->g2, s);
587595 e1 = TAILQ_NEXT(e2, s_entries);
588596 free(e2);
589597 ck_assert_int_eq(e1->g1, 4700);
590 ck_assert_int_eq(e1->g2, NULL);
598 ck_assert_ptr_eq(e1->g2, NULL);
591599 e2 = TAILQ_NEXT(e1, s_entries);
592600 free(e1);
593601 ck_assert_int_eq(e2->g1, -47);
594 ck_assert_int_eq(e2->g2, s);
602 ck_assert_ptr_eq(e2->g2, s);
595603 e1 = TAILQ_NEXT(e2, s_entries);
596604 free(e2);
597 ck_assert_int_eq(e1, NULL);
605 ck_assert_ptr_eq(e1, NULL);
598606 free(s);
599607 free(destination);
600608 }
706714 free(buffer);
707715 ck_assert_int_eq(len, len2);
708716 ck_assert_int_eq(destination->t1, 4544);
709 ck_assert_int_eq(destination->t2, NULL);
717 ck_assert_ptr_eq(destination->t2, NULL);
710718 ck_assert_int_eq(destination->t3, 11111);
711719 free(destination);
712720 }
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <check.h>
118
219 #include "../src/daemon/lldpd.h"
327344 int i;
328345
329346 current = (current + 1)%4;
330 if (buffer[current]) free(buffer[current]); buffer[current] = NULL;
347 free(buffer[current]); buffer[current] = NULL;
331348
332349 for (i = 0; i < namelen; i++) {
333350 /* Not very efficient... */
334351 char *newbuffer = NULL;
335 if (asprintf(&newbuffer, "%s.%lu", buffer[current]?buffer[current]:"", name[i]) == -1) {
352 if (asprintf(&newbuffer, "%s.%lu", buffer[current]?buffer[current]:"",
353 (unsigned long)name[i]) == -1) {
336354 free(buffer[current]);
337355 buffer[current] = NULL;
338356 return NULL;
339357 }
340 if (buffer[current]) free(buffer[current]);
358 free(buffer[current]);
341359 buffer[current] = newbuffer;
342360 }
343361 return buffer[current++];
832850 {
833851 static char *hex[] = { NULL, NULL };
834852 static int which = 0;
835 if (hex[which]) free(hex[which]); hex[which] = NULL;
853 free(hex[which]); hex[which] = NULL;
836854 hex[which] = malloc(len * 3 + 1);
837855 fail_unless(hex[which] != NULL, "Not enough memory?");
838856 for (int i = 0; i < len; i++)
880898 u_char *result, size_t varlen,
881899 oid *target, size_t targetlen, char *repr)
882900 {
901 unsigned long int value;
883902 fail_unless((targetlen == sizeof(lldp_oid)/sizeof(oid) + n->namelen) &&
884903 !memcmp(target, lldp_oid, sizeof(lldp_oid)) &&
885904 !memcmp(target + sizeof(lldp_oid)/sizeof(oid),
895914 fail_unless(varlen == sizeof(unsigned long int),
896915 "Inappropriate length for integer type for OID %s",
897916 repr);
898 fail_unless(n->value.integer ==
899 *(unsigned long int *)result,
917 memcpy(&value, result, sizeof(value));
918 fail_unless(n->value.integer == value,
900919 "For OID %s, expected value %u but got %u instead",
901920 repr,
902921 n->value.integer,
903 *(unsigned long int *)result);
922 value);
904923 break;
905924 default:
906925 fail_unless(((n->value.string.len == varlen) &&
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <sys/socket.h>
219 #include <arpa/inet.h>
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #include <stdlib.h>
118 #include <stdio.h>
219 #include <unistd.h>
0 /* -*- mode: c; c-file-style: "openbsd" -*- */
1 /*
2 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
017 #ifndef _COMMON_H
118 #define _COMMON_H
219
20 #include "check-compat.h"
321 #include "../src/daemon/lldpd.h"
422
523 /* See: