Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Sun, Nov 23, 2014 at 02:17:18PM +0100, Tom Gundersen wrote: On Sun, Nov 23, 2014 at 12:01 PM, Tomasz Torcz to...@pipebreaker.pl wrote: On Sun, Nov 23, 2014 at 10:15:10AM +0530, Susant Sahani wrote: This patch integrates LLDP with networkd. In Fedora, we already have LLDP receiver/broadcaster – ladvd. It has this neat feature of abusing ifAlias by putting endpoint name there. This gives port information right at ip l output: 3: enp5s0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 10:78:d2:cc:7e:b0 brd ff:ff:ff:ff:ff:ff alias connected to Core2-3b-24p (Fa0/7) Would it be possible to implement this in networkd? Definitely possible. However, any suggestions on how to avoid stepping on the toes of other abusers of ifAlias, or is ladvd simply ignoring this? I've enabled it in Fedora's ladvd almost three years ago, and received no bugreports about breaking any other software. ladvd does not take any special precautions. I think it would be safe to refrained from changing ifAlias if: - ifAlias is already set, AND - it doesn't start with connected to -- Tomasz TorczFuneral in the morning, IDE hacking xmpp: zdzich...@chrome.plin the afternoon and evening. - Alan Cox ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Mon, Dec 1, 2014 at 11:01 PM, Tomasz Torcz to...@pipebreaker.pl wrote: On Sun, Nov 23, 2014 at 02:17:18PM +0100, Tom Gundersen wrote: On Sun, Nov 23, 2014 at 12:01 PM, Tomasz Torcz to...@pipebreaker.pl wrote: On Sun, Nov 23, 2014 at 10:15:10AM +0530, Susant Sahani wrote: This patch integrates LLDP with networkd. In Fedora, we already have LLDP receiver/broadcaster – ladvd. It has this neat feature of abusing ifAlias by putting endpoint name there. This gives port information right at ip l output: 3: enp5s0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 10:78:d2:cc:7e:b0 brd ff:ff:ff:ff:ff:ff alias connected to Core2-3b-24p (Fa0/7) Would it be possible to implement this in networkd? Definitely possible. However, any suggestions on how to avoid stepping on the toes of other abusers of ifAlias, or is ladvd simply ignoring this? I've enabled it in Fedora's ladvd almost three years ago, and received no bugreports about breaking any other software. ladvd does not take any special precautions. I think it would be safe to refrained from changing ifAlias if: - ifAlias is already set, AND - it doesn't start with connected to As discussed in the other thread, we'll expose this info through networkctl anyway, so it may not be necessary to use ifAlias (or are there other benefits to this, than just to get it in ip(8) output? -t ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Sunday, November 23, 2014, Susant Sahani sus...@redhat.com wrote: On 11/23/2014 09:33 PM, Umut Tezduyar Lindskog wrote: Hi, Hi Umut, On Sun, Nov 23, 2014 at 5:45 AM, Susant Sahani sus...@redhat.com wrote: This patch integrates LLDP with networkd. Example conf: file : lldp.network [Match] Name=em1 [Network] LLDP=yes --- man/systemd.network.xml | 7 + src/network/networkd-link.c | 45 src/network/networkd-link.h | 2 ++ src/network/networkd-network-gperf.gperf | 1 + src/network/networkd.h | 3 +++ 5 files changed, 58 insertions(+) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 4cc13b2..143c9ee 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -234,6 +234,13 @@ /listitem /varlistentry varlistentry +termvarnameLLDP=/varname /term +listitem +paraA boolean. When true, enables LLDP link receive support. Maybe enum instead of bool? lldp can run in send-only, receive-only, both mode. Now we don't support tx . that's why it's a boolean . Later when we add other features(TX) we will definitely modify that. It'a a very basic implementation now :). Lots of things are in TODO Thanks. thanks Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Sun, Nov 23, 2014 at 10:15:10AM +0530, Susant Sahani wrote: This patch integrates LLDP with networkd. In Fedora, we already have LLDP receiver/broadcaster – ladvd. It has this neat feature of abusing ifAlias by putting endpoint name there. This gives port information right at ip l output: 3: enp5s0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 10:78:d2:cc:7e:b0 brd ff:ff:ff:ff:ff:ff alias connected to Core2-3b-24p (Fa0/7) Would it be possible to implement this in networkd? -- Tomasz Torcz RIP is irrevelant. Spoofing is futile. xmpp: zdzich...@chrome.pl Your routes will be aggreggated. -- Alex Yuriev ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Sun, Nov 23, 2014 at 1:01 PM, Tomasz Torcz to...@pipebreaker.pl wrote: On Sun, Nov 23, 2014 at 10:15:10AM +0530, Susant Sahani wrote: This patch integrates LLDP with networkd. In Fedora, we already have LLDP receiver/broadcaster – ladvd. It has this neat feature of abusing ifAlias by putting endpoint name there. This gives port information right at ip l output: 3: enp5s0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 10:78:d2:cc:7e:b0 brd ff:ff:ff:ff:ff:ff alias connected to Core2-3b-24p (Fa0/7) Would it be possible to implement this in networkd? lldpd has the same feature... In fact, I'm curious what advantages will networkd's implementation have over the existing lldpd and ladvd? -- Mantas Mikulėnas graw...@gmail.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] networkd: integrate LLDP
On Sun, Nov 23, 2014 at 12:01 PM, Tomasz Torcz to...@pipebreaker.pl wrote: On Sun, Nov 23, 2014 at 10:15:10AM +0530, Susant Sahani wrote: This patch integrates LLDP with networkd. In Fedora, we already have LLDP receiver/broadcaster – ladvd. It has this neat feature of abusing ifAlias by putting endpoint name there. This gives port information right at ip l output: 3: enp5s0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 10:78:d2:cc:7e:b0 brd ff:ff:ff:ff:ff:ff alias connected to Core2-3b-24p (Fa0/7) Would it be possible to implement this in networkd? Definitely possible. However, any suggestions on how to avoid stepping on the toes of other abusers of ifAlias, or is ladvd simply ignoring this? We definitely want this information easily accessible through networkctl, so maybe we won't need to touch ifAlias (though I'm absolutely not opposed to the idea as long as we don't gratuitously break other users). Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] networkd: integrate LLDP
This patch integrates LLDP with networkd. Example conf: file : lldp.network [Match] Name=em1 [Network] LLDP=yes --- man/systemd.network.xml | 7 + src/network/networkd-link.c | 45 src/network/networkd-link.h | 2 ++ src/network/networkd-network-gperf.gperf | 1 + src/network/networkd.h | 3 +++ 5 files changed, 58 insertions(+) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 4cc13b2..143c9ee 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -234,6 +234,13 @@ /listitem /varlistentry varlistentry +termvarnameLLDP=/varname/term +listitem +paraA boolean. When true, enables LLDP link receive support. +/para +/listitem +/varlistentry +varlistentry termvarnameAddress=/varname/term listitem paraA static IPv4 or IPv6 address and its prefix length, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index fcfbd3e..f9e4ee9 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -75,6 +75,19 @@ static bool link_ipv4ll_enabled(Link *link) { return link-network-ipv4ll; } +static bool link_lldp_enabled(Link *link) { +if (link-flags IFF_LOOPBACK) +return false; + +if (!link-network) +return false; + +if(link-network-bridge) +return false; + +return link-network-lldp; +} + #define FLAG_STRING(string, flag, old, new) \ (((old ^ new) flag) \ ? ((old flag) ? ( - string) : ( + string)) \ @@ -364,6 +377,16 @@ static int link_stop_clients(Link *link) { } } +if (link-lldp) { + +k = sd_lldp_stop(link-lldp); +if (k 0) { +log_warning_link(link, Could not stop LLDP : %s, + strerror(-r)); +r = k; +} +} + return r; } @@ -973,6 +996,18 @@ static int link_acquire_conf(Link *link) { } } +if (link_lldp_enabled(link)) { +assert(link-lldp); + +log_debug_link(link, Starting LLDP); + +r = sd_lldp_start(link-lldp); +if (r 0) { +log_warning_link(link, could not start LLDP ); +return r; +} +} + return 0; } @@ -1248,6 +1283,16 @@ static int link_configure(Link *link) { return r; } +if (link_lldp_enabled(link)) { +r = sd_lldp_new(link-ifindex, link-ifname, link-mac, link-lldp); +if (r 0) +return r; + +r = sd_lldp_attach_event(link-lldp, NULL, 0); +if (r 0) +return r; +} + if (link_has_carrier(link)) { r = link_acquire_conf(link); if (r 0) diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index 7acf404..b7ed1fb 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -91,6 +91,8 @@ struct Link { sd_icmp6_nd *icmp6_router_discovery; sd_dhcp6_client *dhcp6_client; + +sd_lldp *lldp; }; Link *link_unref(Link *link); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index a736461..8cc3399 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -35,6 +35,7 @@ Network.DHCP,config_parse_dhcp, 0, Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server) Network.IPv4LL, config_parse_bool, 0, offsetof(Network, ipv4ll) Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route) +Network.LLDP,config_parse_bool, 0, offsetof(Network, lldp) Network.Address, config_parse_address, 0, 0 Network.Gateway, config_parse_gateway, 0, 0 Network.Domains, config_parse_domains, 0,