[systemd-devel] [PATCH 1/1] sd-rtnl: Introduce container parsing
Introducing generic container parsing . Now supported for type FLA_INFO_KIND and IFLA_VLAN_ID which can be extended to other container parsing which is based on table based look up. --- src/libsystemd/sd-rtnl/rtnl-internal.h | 20 + src/libsystemd/sd-rtnl/rtnl-message.c | 79 +++--- src/libsystemd/sd-rtnl/rtnl-util.c | 31 + src/libsystemd/sd-rtnl/rtnl-util.h | 2 + src/libsystemd/sd-rtnl/test-rtnl.c | 13 +- 5 files changed, 138 insertions(+), 7 deletions(-) diff --git a/src/libsystemd/sd-rtnl/rtnl-internal.h b/src/libsystemd/sd-rtnl/rtnl-internal.h index f011dbe..eb30682 100644 --- a/src/libsystemd/sd-rtnl/rtnl-internal.h +++ b/src/libsystemd/sd-rtnl/rtnl-internal.h @@ -85,6 +85,15 @@ struct sd_rtnl { sd_event *event; }; +struct rtnl_container { +unsigned short container_type; + +size_t *rta_offset_tb; +unsigned short rta_tb_size; + +LIST_FIELDS(struct rtnl_container, container); +}; + struct sd_rtnl_message { RefCount n_ref; @@ -96,6 +105,10 @@ struct sd_rtnl_message { size_t next_rta_offset; /* offset from hdr to next rta */ size_t *rta_offset_tb; unsigned short rta_tb_size; +struct rtnl_container *container_list[RTNL_CONTAINER_DEPTH]; + +LIST_HEAD(struct rtnl_container, containers); + bool sealed:1; }; @@ -112,6 +125,13 @@ int rtnl_message_parse(sd_rtnl_message *m, struct rtattr *rta, unsigned int rt_len); +int rtnl_container_new(struct rtnl_container **ret, uint16_t container_type); +int rtnl_message_parse_container(sd_rtnl_message *m, + uint8_t type, + uint8_t tb_size, + struct rtattr *rta, + unsigned int rt_len); + /* Make sure callbacks don't destroy the rtnl connection */ #define RTNL_DONT_DESTROY(rtnl) \ _cleanup_rtnl_unref_ _unused_ sd_rtnl *_dont_destroy_##rtnl = sd_rtnl_ref(rtnl) diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index e243c7b..c1ade55 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -58,6 +58,7 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, size_t initial_size) { m-hdr-nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; m-sealed = false; +LIST_HEAD_INIT(m-containers); if (rtnl) m-rtnl = sd_rtnl_ref(rtnl); @@ -276,10 +277,18 @@ sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m) { } sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) { +struct rtnl_container *i, *j; + if (m REFCNT_DEC(m-n_ref) = 0) { sd_rtnl_unref(m-rtnl); free(m-hdr); free(m-rta_offset_tb); + +LIST_FOREACH_SAFE(container, i, j, m-containers) { +free(i-rta_offset_tb); +free(i); +} + free(m); } @@ -752,6 +761,22 @@ int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type) { return -ENOTSUP; } +int sd_rtnl_message_enter_container(sd_rtnl_message *m, unsigned short type) { +struct rtnl_container *itr; + +LIST_FOREACH(container, itr, m-containers) { +if (itr-container_type == type) +break; +} + +if(!itr) +return -ENODATA; + +m-container_list[m-n_containers++] = itr; + +return 0; +} + int sd_rtnl_message_close_container(sd_rtnl_message *m) { assert_return(m, -EINVAL); assert_return(!m-sealed, -EPERM); @@ -807,18 +832,34 @@ int sd_rtnl_message_read(sd_rtnl_message *m, unsigned short *type, void **data) } int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **data) { +size_t *rta_offset; + assert_return(m, -EINVAL); assert_return(m-sealed, -EPERM); assert_return(data, -EINVAL); assert_return(m-rta_offset_tb, -EINVAL); assert_return(type m-rta_tb_size, -EINVAL); -if(!m-rta_offset_tb[type]) -return -ENODATA; +/* We are not inside a container */ +if(!m-n_containers) { +if(!m-rta_offset_tb[type]) +return -ENODATA; -*data = RTA_DATA((struct rtattr *)((uint8_t *) m-hdr + m-rta_offset_tb[type])); +rta_offset = m-rta_offset_tb[type]; +} else { +struct rtnl_container *c; -return 0; +c = m-container_list[m-n_containers - 1]; + +if(!c-rta_offset_tb[type]) +return -ENODATA; + +rta_offset = c-rta_offset_tb[type]; +} + +*data = RTA_DATA((struct rtattr *)((uint8_t *) m-hdr
Re: [systemd-devel] [PATCH 1/1] sd-rtnl: add support for tunnel attributes
On 03/23/2014 09:34 PM, Tom Gundersen wrote: On Sun, Mar 23, 2014 at 4:14 PM, Susant Sahani sus...@redhat.com wrote: Added support for tunneling netlink attrributes (ipip, gre, sit). These works with kernel module ipip, gre and sit . The test cases are commented out because they requirs super user privileges to run and respective kernel modules as well. I guess this relies on the container parsing patch you posted? At least the current test-code does not seem to work without it. Otherwise this patch looks good though, but I have some comments on the container parsing stuff, so let's sort that out before merging Not really . The parsing different than the forming of NL messages. On my test machine: ~~~ 11: eth0@NONE: POINTOPOINT,NOARP mtu 1234 qdisc noop state DOWN mode DEFAULT group default link/ipip 192.168.21.1 peer 192.168.21.2 12: eth1: POINTOPOINT,NOARP mtu 1234 qdisc noop state DOWN mode DEFAULT group default link/sit 192.168.21.3 peer 192.168.21.4 ~~~ Thanks ! Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/1] sd-rtnl: add support for tunnel attributes
On 03/23/2014 10:00 PM, Zbigniew Jędrzejewski-Szmek wrote: On Sun, Mar 23, 2014 at 08:44:09PM +0530, Susant Sahani wrote: Added support for tunneling netlink attrributes (ipip, gre, sit). These works with kernel module ipip, gre and sit . The test cases are commented out because they requirs super user privileges to run and respective kernel modules as well. This isn't a matter to provide those tests. Split out the tests into a separate file if necessary (i.e. if other tests in the same file do not require privileges) and add it to $(manual_tests) in Makefile.am. If some module cannot be loaded, return EXIT_TEST_SKIP instead of an error. Thanks for the tip let me try on that Zbyszek Thanks ! Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/1] sd-rtnl: Introduce container parsing
On 03/24/2014 09:58 PM, Tom Gundersen wrote: On Sat, Mar 22, 2014 at 5:13 PM, Susant Sahani sus...@redhat.com wrote: Introducing generic container parsing . Now supported for type FLA_INFO_KIND and IFLA_VLAN_ID which can be extended to other container parsing which is based on table based look up. --- src/libsystemd/sd-rtnl/rtnl-internal.h | 20 + src/libsystemd/sd-rtnl/rtnl-message.c | 79 +++--- src/libsystemd/sd-rtnl/rtnl-util.c | 31 + src/libsystemd/sd-rtnl/rtnl-util.h | 2 + src/libsystemd/sd-rtnl/test-rtnl.c | 13 +- 5 files changed, 138 insertions(+), 7 deletions(-) diff --git a/src/libsystemd/sd-rtnl/rtnl-internal.h b/src/libsystemd/sd-rtnl/rtnl-internal.h index f011dbe..eb30682 100644 --- a/src/libsystemd/sd-rtnl/rtnl-internal.h +++ b/src/libsystemd/sd-rtnl/rtnl-internal.h @@ -85,6 +85,15 @@ struct sd_rtnl { sd_event *event; }; +struct rtnl_container { +unsigned short container_type; + +size_t *rta_offset_tb; +unsigned short rta_tb_size; + +LIST_FIELDS(struct rtnl_container, container); +}; + struct sd_rtnl_message { RefCount n_ref; @@ -96,6 +105,10 @@ struct sd_rtnl_message { size_t next_rta_offset; /* offset from hdr to next rta */ size_t *rta_offset_tb; unsigned short rta_tb_size; +struct rtnl_container *container_list[RTNL_CONTAINER_DEPTH]; + +LIST_HEAD(struct rtnl_container, containers); + bool sealed:1; }; @@ -112,6 +125,13 @@ int rtnl_message_parse(sd_rtnl_message *m, struct rtattr *rta, unsigned int rt_len); +int rtnl_container_new(struct rtnl_container **ret, uint16_t container_type); +int rtnl_message_parse_container(sd_rtnl_message *m, + uint8_t type, + uint8_t tb_size, + struct rtattr *rta, + unsigned int rt_len); + /* Make sure callbacks don't destroy the rtnl connection */ #define RTNL_DONT_DESTROY(rtnl) \ _cleanup_rtnl_unref_ _unused_ sd_rtnl *_dont_destroy_##rtnl = sd_rtnl_ref(rtnl) diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index e243c7b..c1ade55 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -58,6 +58,7 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, size_t initial_size) { m-hdr-nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; m-sealed = false; +LIST_HEAD_INIT(m-containers); if (rtnl) m-rtnl = sd_rtnl_ref(rtnl); @@ -276,10 +277,18 @@ sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m) { } sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) { +struct rtnl_container *i, *j; + if (m REFCNT_DEC(m-n_ref) = 0) { sd_rtnl_unref(m-rtnl); free(m-hdr); free(m-rta_offset_tb); + +LIST_FOREACH_SAFE(container, i, j, m-containers) { +free(i-rta_offset_tb); +free(i); +} + free(m); } @@ -752,6 +761,22 @@ int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type) { return -ENOTSUP; } +int sd_rtnl_message_enter_container(sd_rtnl_message *m, unsigned short type) { +struct rtnl_container *itr; + +LIST_FOREACH(container, itr, m-containers) { +if (itr-container_type == type) +break; +} Hm, so I don't think this is the right thing to do. The type of a container (or any message) does not make sense unless you know the context (i.e., the types of each of its parent containers). The reason being that the types are just integers, and they are only unique within a given scope. yes correct . After first level parsing rather making generic it's better to make the parser specific to the context , and keep it ready to read. more like parent container having a pointer to child container so that no conflict should come . I now pushed an alternative patch. Could you have a look if it makes sense to you? If am not wrong *sd_rtnl_message_enter_container* trying to parse (rtnl_message_parse) every time a attribute is requested which is inside nested attribute. It would be better to parse only once and keep the data structures ready for reading so that the parsing does not happen each time a attribute is requested. More like from receiving side from kernel should have some intelligence to know what context it's in. Also, would be great if you could respin the tunnel patch on top of this (and following Zbigniew's suggestions for the tests). I would send the attributes patch first then the test cases since it requires libkmod (src/core/kmod-setup.c) support to load
[systemd-devel] [PATCH 1/1] sd-rtnl: add support for tunnel attributes
sd_rtnl_message_append_in6_addr(sd_rtnl_message *m, unsigned short type, con case IFA_LOCAL: case IFA_BROADCAST: case IFA_ANYCAST: +case IFLA_GRE_LOCAL: +case IFLA_GRE_REMOTE: +case IFLA_IPTUN_6RD_PREFIX: ifa = NLMSG_DATA(m-hdr); if (ifa-ifa_family != AF_INET6) diff --git a/src/test/test-rtnl-manual.c b/src/test/test-rtnl-manual.c new file mode 100644 index 000..e76fb81 --- /dev/null +++ b/src/test/test-rtnl-manual.c @@ -0,0 +1,154 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2014 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include netinet/ether.h +#include arpa/inet.h +#include net/if.h +#include linux/ip.h +#include linux/if_tunnel.h +#include libkmod.h + +#include util.h +#include macro.h +#include sd-rtnl.h +#include socket-util.h +#include rtnl-util.h +#include event-util.h +#include rtnl-internal.h + +static int load_module(const char *mod_name) { +struct kmod_ctx *ctx; +struct kmod_list *list = NULL, *l; +int r; + +ctx = kmod_new(NULL, NULL); +if (!ctx) { +kmod_unref(ctx); +return -ENOMEM; +} + +r = kmod_module_new_from_lookup(ctx, mod_name, list); +if (r 0) +return -1; + +kmod_list_foreach(l, list) { +struct kmod_module *mod = kmod_module_get_module(l); + +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); +if (r = 0) +r = 0; +else +r = -1; + +kmod_module_unref(mod); +} + +kmod_module_unref_list(list); +kmod_unref(ctx); + +return r; +} + +static int test_tunnel_configure(sd_rtnl *rtnl) { +int r; +sd_rtnl_message *m, *n; +struct in_addr local, remote; + +/* skip test if module cannot be loaded */ +r = load_module(ipip); +if(r 0) +return EXIT_TEST_SKIP; + +if(getuid() != 0) +return EXIT_TEST_SKIP; + +/* IPIP tunnel */ +assert_se(sd_rtnl_message_new_link(rtnl, m, RTM_NEWLINK, 0) = 0); +assert_se(m); + +assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, eth0) = 0); +assert_se(sd_rtnl_message_append_u32(m, IFLA_MTU, 1234)= 0); + +assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) = 0); +assert_se(sd_rtnl_message_append_string(m, IFLA_INFO_KIND, ipip) = 0); + +assert_se(sd_rtnl_message_open_container(m, IFLA_INFO_DATA) = 0); + +inet_pton(AF_INET, 192.168.21.1, local.s_addr); +assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_LOCAL, local.s_addr) = 0); + +inet_pton(AF_INET, 192.168.21.2, remote.s_addr); +assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_REMOTE, remote.s_addr) = 0); + +assert_se(sd_rtnl_message_close_container(m) = 0); +assert_se(sd_rtnl_message_close_container(m) = 0); + +assert_se(sd_rtnl_call(rtnl, m, -1, 0) == 1); + +assert_se((m = sd_rtnl_message_unref(m)) == NULL); + +r = load_module(sit); +if(r 0) +return EXIT_TEST_SKIP; + +/* sit */ +assert_se(sd_rtnl_message_new_link(rtnl, n, RTM_NEWLINK, 0) = 0); +assert_se(n); + +assert_se(sd_rtnl_message_append_string(n, IFLA_IFNAME, eth1) = 0); +assert_se(sd_rtnl_message_append_u32(n, IFLA_MTU, 1234)= 0); + +assert_se(sd_rtnl_message_open_container(n, IFLA_LINKINFO) = 0); +assert_se(sd_rtnl_message_append_string(n, IFLA_INFO_KIND, sit) = 0); + +assert_se(sd_rtnl_message_open_container(n, IFLA_INFO_DATA) = 0); + +assert_se(sd_rtnl_message_append_u8(n, IFLA_IPTUN_PROTO, IPPROTO_IPIP) = 0); + +inet_pton(AF_INET, 192.168.21.3, local.s_addr); +assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_LOCAL, local.s_addr) = 0); + +inet_pton(AF_INET, 192.168.21.4, remote.s_addr); +assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_REMOTE
[systemd-devel] sd-rtnl: broken test cases
Hi, I am trying to fix the broken test cases which was working previously . With the new refactorization and I tryied to fix them with the attached paatch does not work . Not sure I am doing something wrong or sd-rtnl is broken. -- Thanks ! Susant From 51e8b0a3d18f892c2e0bb86ca86fab99562700b8 Mon Sep 17 00:00:00 2001 From: Susant Sahani sus...@redhat.com Date: Thu, 3 Apr 2014 13:35:56 +0530 Subject: [PATCH] sd-rtnl: fix broken test cases and add support for tunnel This patch fixes the broken test-cases for sd-rtnl and add support for ipip and sit tunnel --- src/libsystemd/sd-rtnl/rtnl-types.c | 37 + src/test/test-rtnl-manual.c | 8 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 29ee5bc..ed1aacd 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -30,6 +30,9 @@ #include linux/if_addr.h #include linux/if.h +#include linux/ip.h +#include linux/if_tunnel.h + #include macro.h #include util.h @@ -98,12 +101,40 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { #endif }; +static const NLType rtnl_link_info_data_ipip_tunnel_types[IFLA_IPTUN_MAX + 1] = { +[IFLA_IPTUN_LINK] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_TTL]= { .type = NLA_U8 }, +[IFLA_IPTUN_TOS]= { .type = NLA_U8 }, +[IFLA_IPTUN_PMTUDISC] = { .type = NLA_U8 }, +}; + +static const NLType rtnl_link_info_data_ipip6_tunnel_types[IFLA_IPTUN_MAX + 1] = { +[IFLA_IPTUN_LINK] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_TTL]= { .type = NLA_U8 }, +[IFLA_IPTUN_TOS]= { .type = NLA_U8 }, +[IFLA_IPTUN_PMTUDISC] = { .type = NLA_U8 }, +[IFLA_IPTUN_FLAGS] = { .type = NLA_U16 }, +[IFLA_IPTUN_PROTO] = { .type = NLA_U8 }, +/* +[IFLA_IPTUN_6RD_PREFIX] = { .len = sizeof(struct in6_addr) }, +[IFLA_IPTUN_6RD_RELAY_PREFIX] = { .type = NLA_U32 }, +[IFLA_IPTUN_6RD_PREFIXLEN] = { .type = NLA_U16 }, +[IFLA_IPTUN_6RD_RELAY_PREFIXLEN] = { .type = NLA_U16 }, +*/ +}; + typedef enum NLUnionLinkInfoData { NL_UNION_LINK_INFO_DATA_BOND, NL_UNION_LINK_INFO_DATA_BRIDGE, NL_UNION_LINK_INFO_DATA_VLAN, NL_UNION_LINK_INFO_DATA_VETH, NL_UNION_LINK_INFO_DATA_MACVLAN, +NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL, +NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL, _NL_UNION_LINK_INFO_DATA_MAX, _NL_UNION_LINK_INFO_DATA_INVALID = -1 } NLUnionLinkInfoData; @@ -117,6 +148,8 @@ static const char* const nl_union_link_info_data_table[_NL_UNION_LINK_INFO_DATA_ [NL_UNION_LINK_INFO_DATA_VLAN] = vlan, [NL_UNION_LINK_INFO_DATA_VETH] = veth, [NL_UNION_LINK_INFO_DATA_MACVLAN] = macvlan, +[NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = ipip_tunnel, +[NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL] = ipip6_tunnel, }; DEFINE_STRING_TABLE_LOOKUP(nl_union_link_info_data, NLUnionLinkInfoData); @@ -132,6 +165,10 @@ static const NLTypeSystem rtnl_link_info_data_type_systems[_NL_UNION_LINK_INFO_D .types = rtnl_link_info_data_veth_types }, [NL_UNION_LINK_INFO_DATA_MACVLAN] = { .max = ELEMENTSOF(rtnl_link_info_data_macvlan_types) - 1, .types = rtnl_link_info_data_macvlan_types }, +[NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipip_tunnel_types) - 1, + .types = rtnl_link_info_data_ipip_tunnel_types }, +[NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipip6_tunnel_types) - 1, + .types = rtnl_link_info_data_ipip6_tunnel_types }, }; static const NLTypeSystemUnion rtnl_link_info_data_type_system_union = { diff --git a/src/test/test-rtnl-manual.c b/src/test/test-rtnl-manual.c index e76fb81..2a77bf7 100644 --- a/src/test/test-rtnl-manual.c +++ b/src/test/test-rtnl-manual.c @@ -84,10 +84,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) { assert_se(sd_rtnl_message_new_link(rtnl, m, RTM_NEWLINK, 0) = 0); assert_se(m); -assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, eth0) = 0); +assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, ipip-tunnel) = 0); assert_se(sd_rtnl_message_append_u32(m, IFLA_MTU, 1234)= 0); -assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) = 0); +assert_se
[systemd-devel] [PATCH] networkd: Introduce ipip tunnel
This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration File : ipip.netdev [NetDev] Name=ipip-tun Kind=tunnel [Tunnel] Kind=ipip Local=192.168.8.102 Remote=10.4.4.4 Dev=em1 Ttl=64 Mtu=1480 --- Makefile.am | 7 +- src/network/networkd-netdev-gperf.gperf | 6 + src/network/networkd-netdev.c| 240 ++- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c | 37 + src/network/networkd.h | 38 + 6 files changed, 322 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index ea7ba57..ecca2bd 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -24,3 +24,9 @@ NetDev.Name, config_parse_ifname, 0, NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind) VLAN.Id, config_parse_uint64,0, offsetof(NetDev, vlanid) MACVLAN.Mode,config_parse_macvlan_mode, 0, offsetof(NetDev, macvlan_mode) +Tunnel.Kind, config_parse_tunnel_kind, 0, offsetof(NetDev, tunnel_kind) +Tunnel.Dev, config_parse_ifname,0, offsetof(NetDev, tunnel_dev) +Tunnel.Ttl, config_parse_int, 0, offsetof(NetDev, tunnel_ttl) +Tunnel.Mtu, config_parse_int, 0, offsetof(NetDev, tunnel_mtu) +Tunnel.Local,config_parse_tunnel_address,0, offsetof(NetDev, tunnel_local) +Tunnel.Remote, config_parse_tunnel_address,0, offsetof(NetDev, tunnel_remote) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 762eff2..6abaf12 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -18,6 +18,12 @@ You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see http://www.gnu.org/licenses/. ***/ +#include netinet/ether.h +#include arpa/inet.h +#include net/if.h +#include linux/ip.h +#include linux/if_tunnel.h +#include libkmod.h #include networkd.h #include network-internal.h @@ -33,6 +39,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = { [NETDEV_KIND_BOND] = bond, [NETDEV_KIND_VLAN] = vlan, [NETDEV_KIND_MACVLAN] = macvlan, +[NETDEV_KIND_TUNNEL] = tunnel, }; DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); @@ -48,6 +55,16 @@ static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode); DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, Failed to parse macvlan mode); +static const char* const tunnel_kind_table[_TUNNEL_KIND_MAX] = { +[TUNNEL_KIND_IPIP] = ipip, +[TUNNEL_KIND_GRE] = gre, +[TUNNEL_KIND_SIT] = sit, +}; + +DEFINE_STRING_TABLE_LOOKUP(tunnel_kind, TunnelKind); +DEFINE_CONFIG_PARSE_ENUM(config_parse_tunnel_kind, tunnel_kind, TunnelKind, Failed to parse tunnel kind); + + void netdev_free(NetDev *netdev) { netdev_enslave_callback *callback; @@ -66,6 +83,7 @@ void netdev_free(NetDev *netdev) { free(netdev-description); free(netdev-name); +free(netdev-tunnel_dev); condition_free_list(netdev-match_host); condition_free_list(netdev-match_virt); @@ -242,6 +260,169 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda return 1; } +static int load_module(const char *mod_name) { +struct kmod_ctx *ctx; +struct kmod_list *list = NULL, *l; +int r; + +ctx = kmod_new(NULL, NULL); +if (!ctx) { +kmod_unref(ctx); +return -ENOMEM; +} + +r = kmod_module_new_from_lookup(ctx, mod_name, list); +if (r 0) +return -1; + +kmod_list_foreach(l, list) { +
Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel
On 04/04/2014 10:00 PM, Tom Gundersen wrote: Hi Susant, Hi Tom, Thanks for reviewing . Thanks for this, looking forward getting this merged! I have some comments below though. I have addressed all your comments. However I have some queries Please find below. On Fri, Apr 4, 2014 at 11:25 AM, Susant Sahani sus...@redhat.com wrote: This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration File : ipip.netdev [NetDev] Name=ipip-tun Kind=tunnel [Tunnel] Kind=ipip Maybe we should simply have [NetDev] Kind=ipip We can still use the same [Tunnel] section for each of the tunnel kinds though. This way we are closer to the rtnl interface, and it seems a bit simpler to me. My intention of kind=tunnel is to keep the all kind of tunnels under the umbrella tunnel. But this also nice. Local=192.168.8.102 Remote=10.4.4.4 Dev=em1 I don't think we should be using the interface name (anywhere, unless we really must). I suggest we do the same with tunnel devices as with other netdev devices. Simply add a Tunnel=ipip-tun to the [Network] section of the corresponding interface and match in this way. Ttl=64 Mtu=1480 I guess these should be upper-case, and MTUBytes should be used as in .link files. So to sum up, I suggest replacing your example with: / ipip.netdev: [NetDev] Name=ipip-tun Kind=tunnel [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 foo.network: [Match] Name=em1 [Network] Tunnel=ipip-tun // Modified . Also, we need to make sure that we only start setting up the tunnel when the underlying device (em1) has reached the correct state, so we really want to initiate the tunnel creation from networkd-link.c (so hooking into this from the .network file is the most convenient). Yes agreed. In the future, we may want to allow a short-hand, where separate .network and .netdev files are not necessarily in some cases, but let's delay that for now. Makefile.am | 7 +- src/network/networkd-netdev-gperf.gperf | 6 + src/network/networkd-netdev.c| 240 ++- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c | 37 + src/network/networkd.h | 38 + 6 files changed, 322 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index ea7ba57..ecca2bd 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -24,3 +24,9 @@ NetDev.Name, config_parse_ifname, 0, NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind) VLAN.Id, config_parse_uint64,0, offsetof(NetDev, vlanid) MACVLAN.Mode,config_parse_macvlan_mode, 0, offsetof(NetDev, macvlan_mode) +Tunnel.Kind, config_parse_tunnel_kind, 0, offsetof(NetDev, tunnel_kind) +Tunnel.Dev, config_parse_ifname,0, offsetof(NetDev, tunnel_dev) +Tunnel.Ttl, config_parse_int, 0, offsetof(NetDev, tunnel_ttl) +Tunnel.Mtu, config_parse_int, 0, offsetof(NetDev, tunnel_mtu) +Tunnel.Local,config_parse_tunnel_address,0, offsetof(NetDev, tunnel_local) +Tunnel.Remote, config_parse_tunnel_address,0, offsetof(NetDev, tunnel_remote) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 762eff2..6abaf12 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -18,6 +18,12 @@ You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see http://www.gnu.org/licenses/. ***/ +#include netinet/ether.h +#include arpa/inet.h +#include net/if.h +#include linux/ip.h +#include linux/if_tunnel.h +#include libkmod.h #include networkd.h #include network-internal.h @@ -33,6 +39,7 @@ static const char
Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel
On 04/07/2014 10:05 AM, Susant Sahani wrote: On 04/04/2014 10:00 PM, Tom Gundersen wrote: Hi Susant, Hi Tom, + log_error_netdev(netdev, + Could not append IFLA_IPTUN_LINK attribute: %s, + strerror(-r)); +return r; +} + +r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LOCAL, netdev-tunnel_local.s_addr); +if (r 0) { +log_error_netdev(netdev, + Could not append IFLA_IPTUN_LOCAL attribute: %s, + strerror(-r)); +return r; +} + +r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_REMOTE, netdev-tunnel_remote.s_addr); +if (r 0) { +log_error_netdev(netdev, + Could not append IFLA_IPTUN_REMOTE attribute: %s, + strerror(-r)); +return r; +} Hm, I guess these should be _append_in_addr() to get the typesafety right (might need to verify that we are using the right types for this in rtnl-types.c. I am missing something in the code . with the current rtnl code it does not get appended. Could you please give a example. r= sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, (const struct in_addr *) netdev-tunnel_local.s_addr); Could not append IFLA_IPTUN_LOCAL attribute: Invalid argument I just figured out this should do . git diff rtnl-types.c diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 27b7d04..585edc6 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -103,8 +103,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = { [IFLA_IPTUN_LINK]= { .type = NLA_U32 }, -[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, -[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_IN_ADDR }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_IN_ADDR }, [IFLA_IPTUN_TTL] = { .type = NLA_U8 }, [IFLA_IPTUN_TOS] = { .type = NLA_U8 }, [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 }, Thanks Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel
This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration file: ipip.netdev [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 file: ipip.network [Match] Name=eth0 [Network] Tunnel=ipip-tun --- Makefile.am | 7 +- src/libsystemd-network/network-internal.c | 33 ++ src/libsystemd-network/network-internal.h | 3 + src/libsystemd/sd-rtnl/rtnl-types.c | 4 +- src/network/networkd-link.c | 25 - src/network/networkd-manager.c| 19 src/network/networkd-netdev-gperf.gperf | 4 + src/network/networkd-netdev.c | 175 +- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c| 37 +++ src/network/networkd.c| 6 + src/network/networkd.h| 27 + 12 files changed, 334 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3686267..5b41cdb 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) { return 0; } + +int load_module(struct kmod_ctx *ctx, const char *mod_name) { +struct kmod_list *modlist = NULL, *l; +int r; + +assert(ctx); +assert(mod_name); + +r = kmod_module_new_from_lookup(ctx, mod_name, modlist); +if (r 0) +return r; + +if (!modlist) { +log_error(Failed to find module '%s', mod_name); +return -ENOENT; +} + +kmod_list_foreach(l, modlist) { +struct kmod_module *mod = kmod_module_get_module(l); + +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); +if (r = 0) +r = 0; +else +r = -1; + +kmod_module_unref(mod); +} + +kmod_module_unref_list(modlist); + +return r; +} diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 65cd0d7..28f53b9 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -24,6 +24,7 @@ #include netinet/ether.h #include netinet/in.h #include stdbool.h +#include libkmod.h #include udev.h #include condition-util.h @@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line, int net_parse_inaddr(const char *address, unsigned char *family, void *dst); int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]); + +int load_module(struct kmod_ctx *ctx, const char *mod_name); diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 44ac5ec..96467a3 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -104,8 +104,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = { [IFLA_IPTUN_LINK]= { .type = NLA_U32 }, -[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, -[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_IN_ADDR }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_IN_ADDR }, [IFLA_IPTUN_TTL] = { .type = NLA_U8 }, [IFLA_IPTUN_TOS] = { .type = NLA_U8 }, [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 }, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 63d253d..848eddd 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) { link_save(link); -if (!link-network-bridge !link-network-bond +if (!link-network-bridge +!link-network-bond +!link-network-tunnel hashmap_isempty(link-network-vlans) hashmap_isempty(link-network-macvlans)) return
Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel
On 04/07/2014 02:39 PM, Tom Gundersen wrote: On Mon, Apr 7, 2014 at 9:44 AM, Susant Sahani sus...@redhat.com wrote: This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration file: ipip.netdev [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 file: ipip.network [Match] Name=eth0 [Network] Tunnel=ipip-tun --- Makefile.am | 7 +- src/libsystemd-network/network-internal.c | 33 ++ src/libsystemd-network/network-internal.h | 3 + src/libsystemd/sd-rtnl/rtnl-types.c | 4 +- src/network/networkd-link.c | 25 - src/network/networkd-manager.c| 19 src/network/networkd-netdev-gperf.gperf | 4 + src/network/networkd-netdev.c | 175 +- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c| 37 +++ src/network/networkd.c| 6 + src/network/networkd.h| 27 + 12 files changed, 334 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3686267..5b41cdb 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) { return 0; } + +int load_module(struct kmod_ctx *ctx, const char *mod_name) { +struct kmod_list *modlist = NULL, *l; +int r; + +assert(ctx); +assert(mod_name); + +r = kmod_module_new_from_lookup(ctx, mod_name, modlist); +if (r 0) +return r; + +if (!modlist) { +log_error(Failed to find module '%s', mod_name); +return -ENOENT; +} + +kmod_list_foreach(l, modlist) { +struct kmod_module *mod = kmod_module_get_module(l); + +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); +if (r = 0) +r = 0; +else +r = -1; + +kmod_module_unref(mod); +} + +kmod_module_unref_list(modlist); + +return r; +} diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 65cd0d7..28f53b9 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -24,6 +24,7 @@ #include netinet/ether.h #include netinet/in.h #include stdbool.h +#include libkmod.h #include udev.h #include condition-util.h @@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line, int net_parse_inaddr(const char *address, unsigned char *family, void *dst); int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]); + +int load_module(struct kmod_ctx *ctx, const char *mod_name); diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 44ac5ec..96467a3 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -104,8 +104,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = { [IFLA_IPTUN_LINK]= { .type = NLA_U32 }, -[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, -[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_IN_ADDR }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_IN_ADDR }, [IFLA_IPTUN_TTL] = { .type = NLA_U8 }, [IFLA_IPTUN_TOS] = { .type = NLA_U8 }, [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 }, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 63d253d..848eddd 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) { link_save(link); -if (!link-network-bridge !link-network-bond +if (!link-network-bridge +!link-network-bond +!link
Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel
On 04/07/2014 03:13 PM, Jóhann B. Guðmundsson wrote: On 04/07/2014 04:35 AM, Susant Sahani wrote: This will be much nicer if we simply use ipip as the kind, rather than tunnel. Done ! Hmm... I think it got right the first place from a usability perspective as in kind=tunnel then we need to introduce mode= in the associated network file as in Yes from user perceptive this is nice but few line code more ;) |.netdev| |[NetDev] Name=tunnel0 Kind=tunnel ||[Match] Name=enp2s0 .network [Network] |||# one of the following| Mode=ipip | gre | sit | isatap | vti Address=192.168.0.15/24 Gateway=192.168.0.1| Or have the Mode= in the .netdev file itself JBG Thanks, Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel
This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration file: ipip.netdev -- [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 file: ipip.network -- [Match] Name=eth0 [Network] Tunnel=ipip-tun --- Makefile.am | 7 +- src/libsystemd-network/network-internal.c | 33 ++ src/libsystemd-network/network-internal.h | 3 + src/libsystemd/sd-rtnl/rtnl-types.c | 4 +- src/network/networkd-link.c | 25 - src/network/networkd-manager.c| 14 +++ src/network/networkd-netdev-gperf.gperf | 4 + src/network/networkd-netdev.c | 169 +- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c| 37 +++ src/network/networkd.c| 6 ++ src/network/networkd.h| 27 + 12 files changed, 323 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3686267..5b41cdb 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) { return 0; } + +int load_module(struct kmod_ctx *ctx, const char *mod_name) { +struct kmod_list *modlist = NULL, *l; +int r; + +assert(ctx); +assert(mod_name); + +r = kmod_module_new_from_lookup(ctx, mod_name, modlist); +if (r 0) +return r; + +if (!modlist) { +log_error(Failed to find module '%s', mod_name); +return -ENOENT; +} + +kmod_list_foreach(l, modlist) { +struct kmod_module *mod = kmod_module_get_module(l); + +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); +if (r = 0) +r = 0; +else +r = -1; + +kmod_module_unref(mod); +} + +kmod_module_unref_list(modlist); + +return r; +} diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 65cd0d7..28f53b9 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -24,6 +24,7 @@ #include netinet/ether.h #include netinet/in.h #include stdbool.h +#include libkmod.h #include udev.h #include condition-util.h @@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line, int net_parse_inaddr(const char *address, unsigned char *family, void *dst); int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]); + +int load_module(struct kmod_ctx *ctx, const char *mod_name); diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 44ac5ec..96467a3 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -104,8 +104,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = { [IFLA_IPTUN_LINK]= { .type = NLA_U32 }, -[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, -[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_IN_ADDR }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_IN_ADDR }, [IFLA_IPTUN_TTL] = { .type = NLA_U8 }, [IFLA_IPTUN_TOS] = { .type = NLA_U8 }, [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 }, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 63d253d..848eddd 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) { link_save(link); -if (!link-network-bridge !link-network-bond +if (!link-network-bridge +!link-network-bond +!link-network-tunnel hashmap_isempty(link-network-vlans)
Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel
On 04/09/2014 01:33 AM, Umut Tezduyar Lindskog wrote: Hi, Few minor suggestions, if you care. Hi sorry for replying late :) On Tue, Apr 8, 2014 at 5:22 AM, Susant Sahani sus...@redhat.com wrote: This patch enables basic ipip tunnel support. It works with kernel module ipip Example configuration file: ipip.netdev -- [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 file: ipip.network -- [Match] Name=eth0 [Network] Tunnel=ipip-tun --- Makefile.am | 7 +- src/libsystemd-network/network-internal.c | 33 ++ src/libsystemd-network/network-internal.h | 3 + src/libsystemd/sd-rtnl/rtnl-types.c | 4 +- src/network/networkd-link.c | 25 - src/network/networkd-manager.c| 14 +++ src/network/networkd-netdev-gperf.gperf | 4 + src/network/networkd-netdev.c | 169 +- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c| 37 +++ src/network/networkd.c| 6 ++ src/network/networkd.h| 27 + 12 files changed, 323 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index c51f6ae..60c7016 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ - libsystemd-networkd-core.la - + libsystemd-networkd-core.la \ + -lkmod noinst_LTLIBRARIES += \ libsystemd-networkd-core.la @@ -4189,7 +4189,8 @@ test_network_SOURCES = \ src/network/test-network.c test_network_LDADD = \ - libsystemd-networkd-core.la + libsystemd-networkd-core.la \ + -lkmod tests += \ test-network diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3686267..5b41cdb 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) { return 0; } + +int load_module(struct kmod_ctx *ctx, const char *mod_name) { +struct kmod_list *modlist = NULL, *l; +int r; + +assert(ctx); +assert(mod_name); + +r = kmod_module_new_from_lookup(ctx, mod_name, modlist); +if (r 0) +return r; + +if (!modlist) { +log_error(Failed to find module '%s', mod_name); +return -ENOENT; +} + +kmod_list_foreach(l, modlist) { +struct kmod_module *mod = kmod_module_get_module(l); Small optimization but maybe move stuct kmod_module *mod; outside of the for each. Well The compiler is intelligent enough to do so . and the stack does not grow as you think (i am guessing this is what you meant ) + +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); If r is -1 from previous run, we are overriding it here. +if (r = 0) +r = 0; +else +r = -1; + +kmod_module_unref(mod); +} + +kmod_module_unref_list(modlist); + +return r; +} diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 65cd0d7..28f53b9 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -24,6 +24,7 @@ #include netinet/ether.h #include netinet/in.h #include stdbool.h +#include libkmod.h #include udev.h #include condition-util.h @@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line, int net_parse_inaddr(const char *address, unsigned char *family, void *dst); int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]); + +int load_module(struct kmod_ctx *ctx, const char *mod_name); diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index 44ac5ec..96467a3 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -104,8 +104,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = { [IFLA_IPTUN_LINK]= { .type = NLA_U32 }, -[IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, -[IFLA_IPTUN_REMOTE] = { .type = NLA_U32 }, +[IFLA_IPTUN_LOCAL] = { .type = NLA_IN_ADDR }, +[IFLA_IPTUN_REMOTE] = { .type = NLA_IN_ADDR }, [IFLA_IPTUN_TTL] = { .type = NLA_U8 }, [IFLA_IPTUN_TOS] = { .type = NLA_U8 }, [IFLA_IPTUN_PMTUDISC]= { .type
Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel
On 04/08/2014 12:54 PM, Jóhann B. Guðmundsson wrote: On 04/08/2014 03:22 AM, Susant Sahani wrote: file: ipip.netdev -- [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Local=192.168.8.102 Remote=10.4.4.4 TTL=64 MTUBytes=1480 file: ipip.network -- [Match] Name=eth0 [Network] Tunnel=ipip-tun I think this is worse from previous example since now you have moved the network definitions out from the network file and into the net device file. Well thanks for the comment . I am open for the change . Leaving tom to comment on this . The best way to define this from my pov is like this since the tunnel is the network device type aka Kind=tunnel and the mode is the operation mode of that tunnel ||tunnel0|.netdev| |[NetDev] Name=|||tunnel0| Kind=tunnel ||[Match] Name=enp2s0 .network [Network] |||# one of the following| Mode=ipip | gre | sit | isatap | vti -- Address=192.168.0.15/24 Gateway=192.168.0.1| Or |tunnel0.netdev| |[NetDev] Name=|||tunnel0| Kind=tunnel ||[Match] Name=enp2s0 .network [Network] |||# one of the following| Mode=ipip | gre | sit | isatap | vti -- ||DHCP=yes| or if you want to be consistent with how it's done with bridging you would swap the Mode= in the [Network] section to Tunnel=|ipip | gre | sit | isatap | vti| JBG Thanks, Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] sd-rtnl: fix test cases for rtnl tunnel attr
This patch fix the test cases for tunneling type safe address rtnl attributes and enhances module loading support . --- src/test/test-rtnl-manual.c | 49 + 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/src/test/test-rtnl-manual.c b/src/test/test-rtnl-manual.c index c8133db..612a467 100644 --- a/src/test/test-rtnl-manual.c +++ b/src/test/test-rtnl-manual.c @@ -34,35 +34,52 @@ #include event-util.h #include rtnl-internal.h -static int load_module(const char *mod_name) { -struct kmod_ctx *ctx; -struct kmod_list *list = NULL, *l; -int r; +static struct kmod_ctx *ctx; + +static int kmod_init_ctx(void) { ctx = kmod_new(NULL, NULL); if (!ctx) { -kmod_unref(ctx); return -ENOMEM; } -r = kmod_module_new_from_lookup(ctx, mod_name, list); +return 0; +} + +static void kmod_ctx_free(void) { + +assert(ctx); + +kmod_unref(ctx); +} + +static int load_module(const char *mod_name) { +struct kmod_list *modlist = NULL, *l; +int r; +int i = 0; + +r = kmod_module_new_from_lookup(ctx, mod_name, modlist); if (r 0) return -1; -kmod_list_foreach(l, list) { +kmod_list_foreach(l, modlist) { struct kmod_module *mod = kmod_module_get_module(l); r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL); + +printf(i = %d, r = %d\n, i++, r); + if (r = 0) r = 0; else r = -1; kmod_module_unref(mod); + + } -kmod_module_unref_list(list); -kmod_unref(ctx); +kmod_module_unref_list(modlist); return r; } @@ -72,6 +89,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) { sd_rtnl_message *m, *n; struct in_addr local, remote; +r = kmod_init_ctx(); +if(r 0) +return EXIT_TEST_SKIP; + /* skip test if module cannot be loaded */ r = load_module(ipip); if(r 0) @@ -92,10 +113,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) { assert_se(sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, ipip) = 0); inet_pton(AF_INET, 192.168.21.1, local.s_addr); -assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_LOCAL, local.s_addr) = 0); +assert_se(sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, local) = 0); inet_pton(AF_INET, 192.168.21.2, remote.s_addr); -assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_REMOTE, remote.s_addr) = 0); +assert_se(sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, remote) = 0); assert_se(sd_rtnl_message_close_container(m) = 0); assert_se(sd_rtnl_message_close_container(m) = 0); @@ -122,10 +143,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) { assert_se(sd_rtnl_message_append_u8(n, IFLA_IPTUN_PROTO, IPPROTO_IPIP) = 0); inet_pton(AF_INET, 192.168.21.3, local.s_addr); -assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_LOCAL, local.s_addr) = 0); +assert_se(sd_rtnl_message_append_in_addr(n, IFLA_IPTUN_LOCAL, local) = 0); inet_pton(AF_INET, 192.168.21.4, remote.s_addr); -assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_REMOTE, remote.s_addr) = 0); +assert_se(sd_rtnl_message_append_in_addr(n, IFLA_IPTUN_REMOTE, remote) = 0); assert_se(sd_rtnl_message_close_container(n) = 0); assert_se(sd_rtnl_message_close_container(n) = 0); @@ -134,6 +155,8 @@ static int test_tunnel_configure(sd_rtnl *rtnl) { assert_se((m = sd_rtnl_message_unref(n)) == NULL); +kmod_ctx_free(); + return EXIT_SUCCESS; } -- 1.9.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] networkd: ipip tunell add address support
This patch extends supports to configure address for ipip tunnel patch. File: ipip.network [Match] Name=em1 [Network] Tunnel=ipip-tun Address=192.168.10.24 --- src/network/networkd-address.c | 8 +++- src/network/networkd-link.c| 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 87688a5..5d8bec5 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -231,6 +231,7 @@ int address_update(Address *address, Link *link, int address_configure(Address *address, Link *link, sd_rtnl_message_handler_t callback) { _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL; +int if_index; int r; assert(address); @@ -240,8 +241,13 @@ int address_configure(Address *address, Link *link, assert(link-manager); assert(link-manager-rtnl); +if(link-network-tunnel) +if_index = if_nametoindex(link-network-tunnel-name); +else +if_index = link-ifindex; + r = sd_rtnl_message_new_addr(link-manager-rtnl, req, RTM_NEWADDR, - link-ifindex, address-family); + if_index, address-family); if (r 0) { log_error(Could not allocate RTM_NEWADDR message: %s, strerror(-r)); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 92434a6..7c9616a 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1305,6 +1305,7 @@ static int link_enter_enslave(Link *link) { } link-enslaving ++; +return link_enslaved(link); } HASHMAP_FOREACH(vlan, link-network-vlans, i) { -- 1.9.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] networkd: ipip tunell add address support
On 04/14/2014 03:50 PM, Jóhann B. Guðmundsson wrote: On 04/14/2014 04:06 AM, Susant Sahani wrote: This patch extends supports to configure address for ipip tunnel patch. File: ipip.network [Match] Name=em1 [Network] Tunnel=ipip-tun Address=192.168.10.24 You might want to skip tun from ipip-tun to match modes directly ( ip tu ad ipiptun mode ipip -- local foo remote bar ttl 64 dev em1 ) or atleast remove the - so it matches the ip commands which uses ipiptun, gretun and sittun ( ip tu ad ipiptun -- mode ipip local foo remote bar ttl 64 dev em1 ) It's a name not tunnel type. Tunnel type configured in .netdev . you can put anything here . Should match the .netdev Name='XYZ' The Kind is mode which you can replace with ipip/sit/gre . file: ipip.netdev -- [NetDev] Name=ipip-tun===Name Kind=ipip == tunnel type JBG Thanks, Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] networkd: ipip tunell add address support
On 04/14/2014 04:04 PM, Jóhann B. Guðmundsson wrote: On 04/14/2014 10:31 AM, Susant Sahani wrote: It's a name not tunnel type. Tunnel type configured in .netdev . you can put anything here . Should match the .netdev Name='XYZ' The Kind is mode which you can replace with ipip/sit/gre . file: ipip.netdev -- [NetDev] Name=ipip-tun===Name Kind=ipip == tunnel type I thought you had switched to correct it Kind=tunnel just like you define bridging, bonding and vlan there, with Tunnel= in the network section setting the mode of the tunnel. hmm . That was my original idea. You might want to check . I guess Tom just has to rule on this since to me how you are implementing things adds an additional learning curve to administrators both since it deviates from the command line as well as configuration this from /etc/net configuration perspective. Yes :) JBG Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc
This patch adds path of mtu discovery for sit tunnel. To enable/disable DiscoverPathMTU is introduced. Example configuration file: sit.netdev [NetDev] Name=sit-tun Kind=sit MTUBytes=1480 [Tunnel] DiscoverPathMTU=1 Local=X.X.X.X Remote=X.X.X.X By default pmtudisc is turned on , if DiscoverPathMTU is missing from the config. To turn it off DiscoverPathMTU=0 needs to be set. --- src/network/networkd-netdev-gperf.gperf | 1 + src/network/networkd-netdev.c | 1 + src/network/networkd-tunnel.c | 12 src/network/networkd.h | 1 + 4 files changed, 15 insertions(+) diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 29889cd..b171d76 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -29,3 +29,4 @@ Tunnel.Local,config_parse_tunnel_address, 0, Tunnel.Remote, config_parse_tunnel_address,0, offsetof(NetDev, tunnel_remote) Tunnel.TOS, config_parse_unsigned, 0, offsetof(NetDev, tunnel_tos) Tunnel.TTL, config_parse_unsigned, 0, offsetof(NetDev, tunnel_ttl) +Tunnel.DiscoverPathMTU, config_parse_bool, 0, offsetof(NetDev, tunnel_pmtudisc) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index c54b0c1..63f8ff7 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -545,6 +545,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev-kind = _NETDEV_KIND_INVALID; netdev-macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID; netdev-vlanid = VLANID_MAX + 1; +netdev-tunnel_pmtudisc = 1; r = config_parse(NULL, filename, file, Match\0NetDev\0VLAN\0MACVLAN\0Tunnel\0, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c index fee474c..2cabc42 100644 --- a/src/network/networkd-tunnel.c +++ b/src/network/networkd-tunnel.c @@ -131,6 +131,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) { static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { NetDev *netdev; +uint8_t pmtudisc; int r; assert(link); @@ -207,6 +208,17 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } +if(!netdev-tunnel_pmtudisc) +pmtudisc = 0; + +r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, pmtudisc); +if (r 0) { +log_error_netdev(netdev, + Could not append IFLA_IPTUN_PMTUDISC attribute: %s, + strerror(-r)); +return r; +} + r = sd_rtnl_message_close_container(m); if (r 0) { log_error_netdev(netdev, diff --git a/src/network/networkd.h b/src/network/networkd.h index cfe24f5..98ea66e 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -107,6 +107,7 @@ struct NetDev { int ifindex; NetDevState state; +bool tunnel_pmtudisc; unsigned tunnel_ttl; unsigned tunnel_tos; struct in_addr tunnel_local; -- 1.9.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc
Hi Lennart , Thanks for reviewing . static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { NetDev *netdev; +uint8_t pmtudisc; Hmm, you never initialized the variable if mtu disc is off, no? oops ! yes This should be uint8_t pmtudisc = 1 . with aligned to kernel code , if this is missing by default it's turned on . We only use this variable to turn off. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc
V2 fixed the uninitialized variable pmtudisc. This patch adds path of mtu discovery for sit tunnel. To enable/disable DiscoverPathMTU is introduced. Example configuration file: sit.netdev [NetDev] Name=sit-tun Kind=sit MTUBytes=1480 [Tunnel] DiscoverPathMTU=1 Local=X.X.X.X Remote=X.X.X.X By default pmtudisc is turned on , if DiscoverPathMTU is missing from the config. To turn it off DiscoverPathMTU=0 needs to be set. --- src/network/networkd-netdev-gperf.gperf | 1 + src/network/networkd-netdev.c | 1 + src/network/networkd-tunnel.c | 12 src/network/networkd.h | 1 + 4 files changed, 15 insertions(+) diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 29889cd..b171d76 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -29,3 +29,4 @@ Tunnel.Local,config_parse_tunnel_address, 0, Tunnel.Remote, config_parse_tunnel_address,0, offsetof(NetDev, tunnel_remote) Tunnel.TOS, config_parse_unsigned, 0, offsetof(NetDev, tunnel_tos) Tunnel.TTL, config_parse_unsigned, 0, offsetof(NetDev, tunnel_ttl) +Tunnel.DiscoverPathMTU, config_parse_bool, 0, offsetof(NetDev, tunnel_pmtudisc) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index c54b0c1..63f8ff7 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -545,6 +545,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev-kind = _NETDEV_KIND_INVALID; netdev-macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID; netdev-vlanid = VLANID_MAX + 1; +netdev-tunnel_pmtudisc = 1; r = config_parse(NULL, filename, file, Match\0NetDev\0VLAN\0MACVLAN\0Tunnel\0, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c index fee474c..bb2d805 100644 --- a/src/network/networkd-tunnel.c +++ b/src/network/networkd-tunnel.c @@ -131,6 +131,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) { static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { NetDev *netdev; +uint8_t pmtudisc = 1; int r; assert(link); @@ -207,6 +208,17 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } +if(!netdev-tunnel_pmtudisc) +pmtudisc = 0; + +r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, pmtudisc); +if (r 0) { +log_error_netdev(netdev, + Could not append IFLA_IPTUN_PMTUDISC attribute: %s, + strerror(-r)); +return r; +} + r = sd_rtnl_message_close_container(m); if (r 0) { log_error_netdev(netdev, diff --git a/src/network/networkd.h b/src/network/networkd.h index cfe24f5..98ea66e 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -107,6 +107,7 @@ struct NetDev { int ifindex; NetDevState state; +bool tunnel_pmtudisc; unsigned tunnel_ttl; unsigned tunnel_tos; struct in_addr tunnel_local; -- 1.9.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc
+netdev-tunnel_pmtudisc = 1; Should be true, not 1. If something is of type bool we should use true for setting it and false for unsetting it. And this is of type bool. Ok . static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { NetDev *netdev; +uint8_t pmtudisc = 1; int r; assert(link); @@ -207,6 +208,17 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } +if(!netdev-tunnel_pmtudisc) +pmtudisc = 0; This should also be enough: pmtudisc = netdev-tunnel_pmtudisc; No need to invole an if check here... bools automatically convert to 0 and 1 if you assign them to an integer. Cool. thanks Lennart Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc
On 05/22/2014 08:32 AM, Susant Sahani wrote: static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { NetDev *netdev; +uint8_t pmtudisc = 1; int r; assert(link); @@ -207,6 +208,17 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) { return r; } +if(!netdev-tunnel_pmtudisc) +pmtudisc = 0; This should also be enough: pmtudisc = netdev-tunnel_pmtudisc; No need to invole an if check here... bools automatically convert to 0 and 1 if you assign them to an integer. Cool. thanks I guess we can directly assign the bool to the a integer and eliminate the uint8_t pmtudisc and pmtudisc = netdev-tunnel_pmtudisc; altogether. like sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, netdev-tunnel_pmtudisc); Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] SIT tunnel does not work
On 06/21/2014 02:47 PM, Tomasz Torcz wrote: Hi, I've tried to establish SIT tunnel to Hurricane Electric, using systemd v214. It does not work, device do not appear. I'm concerned about networkd discarding part of netlink messages, see below. Original instruction is provided by HE, rest is my shot at translating it into netdev (nb. manpage wasn't updated when tunnel features went in). The se.network file has conf problem. you need to put the interface name rather tunnel name like eth0/em1 Original instruction: - modprobe ipv6 ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local 109.107.25.67 ttl 255 ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local dev eth0 ip link set he-ipv6 up ip addr add 2001:470:70:68d::2/64 dev he-ipv6 ip route add ::/0 dev he-ipv6 ip -f inet6 addr $ cat he.netdev --- [NetDev] Name=he Kind=sit [Tunnel] Local=109.107.25.67 Remote=216.66.80.162 $ cat he.network [Match] Name=he you need to supply the interface name here [Match] Name=em1 ==interface name 12: he: POINTOPOINT,NOARP mtu 1480 qdisc noop state DOWN mode DEFAULT group default link/sit 109.107.25.67 peer 216.66.80.162 [Network] Tunnel=he Address=2001:470:70:68d::2/64 $ SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd --- timestamp of '/etc/systemd/network' changed he: loaded sit sd-rtnl: discarding 20 bytes of incoming message could not add new link could not add new link eth1: link 3 added eth1: udev initialized link eth1: unmanaged eth1: flags change: +UP +LOWER_UP +RUNNING +MULTICAST +BROADCAST … -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Introduce tuntap device
; r = config_parse(NULL, filename, file, - Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0, + Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0TUNTAP\0, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, false, false, netdev); if (r 0) { @@ -666,6 +679,12 @@ static int netdev_load_one(Manager *manager, const char *filename) { return 0; } +if (netdev-kind == NETDEV_KIND_TUNTAP +netdev-tuntap_kind == _TUNTAP_KIND_INVALID) { +log_warning(TunTap without Mode configured in %s. Ignoring, filename); +return 0; +} + netdev-filename = strdup(filename); if (!netdev-filename) return log_oom(); @@ -719,6 +738,13 @@ static int netdev_load_one(Manager *manager, const char *filename) { if (r 0) return r; break; + +case NETDEV_KIND_TUNTAP: +r = netdev_create_tuntap(netdev); +if (r 0) +return r; +break; + default: break; } diff --git a/src/network/networkd-tuntap.c b/src/network/networkd-tuntap.c new file mode 100644 index 000..f138b8a --- /dev/null +++ b/src/network/networkd-tuntap.c @@ -0,0 +1,106 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** +This file is part of systemd. + +Copyright 2014 Susant Sahani sus...@redhat.com + +systemd is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +systemd is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include sys/ioctl.h +#include net/if.h +#include linux/if_tun.h + +#include networkd.h + +#define TUN_DEV /dev/net/tun + + +static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { + +assert(netdev); +assert(ifr); + +memset(ifr, 0, sizeof(*ifr)); + +if(netdev-tuntap_kind == TUNTAP_KIND_TAP) +ifr-ifr_flags |= IFF_TAP; +else +ifr-ifr_flags |= IFF_TUN; + +if(!netdev-packet_info) +ifr-ifr_flags = ~IFF_NO_PI; +else +ifr-ifr_flags |= IFF_NO_PI; + +if(netdev-one_queue) +ifr-ifr_flags |= IFF_ONE_QUEUE; + +if(netdev-multi_queue) +ifr-ifr_flags |= IFF_MULTI_QUEUE; + +strncpy(ifr-ifr_name, netdev-ifname, IFNAMSIZ-1); + +return 0; +} + +static int netdev_tuntap_add(struct ifreq *ifr) +{ +int fd; +int r = 0; + +fd = open(TUN_DEV, O_RDWR); +if (fd 0) { +r = -errno; +goto fail; +} + +r = ioctl(fd, TUNSETIFF, ifr); +if (r 0) { +r = -errno; +goto fail; +} + +r = ioctl(fd, TUNSETPERSIST, 1); +if (r 0) { +r = -errno; +goto fail; +} + + fail: +close(fd); + +return r; +} + +int netdev_create_tuntap(NetDev *netdev) { +int r; +struct ifreq ifr; + +assert(netdev); +assert(netdev-ifname); + +if(netdev-kind != NETDEV_KIND_TUNTAP) +return -ENOTSUP; + +r = netdev_fill_tuntap_message(netdev, ifr); +if(r 0) +return r; + +log_debug_netdev(netdev, Creating tuntap netdev: %s, + netdev_kind_to_string(netdev-kind)); + +return netdev_tuntap_add(ifr); +} diff --git a/src/network/networkd.h b/src/network/networkd.h index b7b1d90..ab1ca4e 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -80,6 +80,7 @@ typedef enum NetDevKind { NETDEV_KIND_SIT, NETDEV_KIND_VETH, NETDEV_KIND_VTI, +NETDEV_KIND_TUNTAP, _NETDEV_KIND_MAX, _NETDEV_KIND_INVALID = -1 } NetDevKind; @@ -93,6 +94,13 @@ typedef enum NetDevState { _NETDEV_STATE_INVALID = -1, } NetDevState; +typedef enum TunTapKind { +TUNTAP_KIND_TAP, +TUNTAP_KIND_TUNNEL, +_TUNTAP_KIND_MAX, +_TUNTAP_KIND_INVALID = -1 +} TunTapKind; + struct NetDev { Manager *manager; @@ -112,6 +120,7 @@ struct NetDev { struct ether_addr *mac; struct ether_addr *mac_peer; NetDevKind kind; +TunTapKind
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/24/2014 10:39 PM, Marcel Holtmann wrote: Hi Tom, This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Hm, maybe call this TunTap instead? Mode=tap OneQueue=true MultiQueue=true PacketInfo=true I wonder if it might be better separate in Tun and in Tap devices. Tun devices are IP only devices and Tap devices are actual Ethernet devices. It looks a bit silly that you have to specific Kind=tuntap only to later specific Mode=tap. Why not just do Kind=tap device? That under Linux the setup of both Tun and Tap devices happens via /dev/net/tun is just an implementation detail. The intention behind keeping Kind=tuntap is related to the driver. Kind - driver Mode- how it behaves . Of cource what you saying is correct implementation details but Kind is related to the driver. Regards Marcel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/24/2014 10:31 PM, Tom Gundersen wrote: Looks great, just minor comments below. On Tue, Jun 24, 2014 at 6:25 PM, Susant Sahani sus...@redhat.com wrote: This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Hm, maybe call this TunTap instead? yes . will change that . Mode=tap OneQueue=true MultiQueue=true PacketInfo=true Added: 1. file networkd-tuntap.c 2. enum TunTapKind 3. NETDEV_KIND_TUNTAP 4. TUNTAP Section to parse conf and gperf conf parameters TODO: 1. Add user(uid) group(gid) parameters Yeah, this would be great to have as well. I will add this in a follow up patch. --- Makefile.am | 1 + src/network/networkd-netdev-gperf.gperf | 4 ++ src/network/networkd-netdev.c | 40 +--- src/network/networkd-tuntap.c | 106 src/network/networkd.h | 19 ++ 5 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 src/network/networkd-tuntap.c diff --git a/Makefile.am b/Makefile.am index 37a164e..d9cba3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4479,6 +4479,7 @@ libsystemd_networkd_core_la_SOURCES = \ src/network/networkd-tunnel.c \ src/network/networkd-veth.c \ src/network/networkd-vxlan.c \ + src/network/networkd-tuntap.c \ src/network/networkd-network.c \ src/network/networkd-address.c \ src/network/networkd-route.c \ diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 9125e1d..d29e41d 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -38,3 +38,7 @@ VXLAN.Group, config_parse_tunnel_address, 0, VXLAN.TOS, config_parse_unsigned, 0, offsetof(NetDev, tos) VXLAN.TTL, config_parse_unsigned, 0, offsetof(NetDev, ttl) VXLAN.MacLearning, config_parse_bool, 0, offsetof(NetDev, learning) +TUNTAP.Mode, config_parse_tuntap_kind, 0, offsetof(NetDev, tuntap_kind) +TUNTAP.OneQueue, config_parse_bool, 0, offsetof(NetDev, one_queue) +TUNTAP.MultiQueue, config_parse_bool, 0, offsetof(NetDev, multi_queue) +TUNTAP.PacketInfo, config_parse_bool, 0, offsetof(NetDev, packet_info) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index dcf7596..41db707 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -41,7 +41,8 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = { [NETDEV_KIND_GRE] = gre, [NETDEV_KIND_SIT] = sit, [NETDEV_KIND_VETH] = veth, -[NETDEV_KIND_VTI] = vti +[NETDEV_KIND_VTI] = vti, +[NETDEV_KIND_TUNTAP] = tuntap }; DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); @@ -57,6 +58,14 @@ static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode); DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, Failed to parse macvlan mode); +static const char* const tuntap_kind_table[_TUNTAP_KIND_MAX] = { +[TUNTAP_KIND_TAP] = tap, +[TUNTAP_KIND_TUNNEL] = tunnel, +}; + +DEFINE_STRING_TABLE_LOOKUP(tuntap_kind, TunTapKind); +DEFINE_CONFIG_PARSE_ENUM(config_parse_tuntap_kind, tuntap_kind, TunTapKind, Failed to parse tuntap kind); + static void netdev_cancel_callbacks(NetDev *netdev) { _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL; netdev_enslave_callback *callback; @@ -521,11 +530,13 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { return -EINVAL; } -if (!streq(kind, received_kind)) { -log_error_netdev(netdev, Received newlink with wrong KIND %s, - expected %s, received_kind, kind); -netdev_enter_failed(netdev); -return r; +if (netdev-kind != NETDEV_KIND_TUNTAP) { Probably better explain why tuntap needs special casing in a comment here. +if (!streq(kind, received_kind)) { +log_error_netdev(netdev, Received newlink with wrong KIND %s, + expected %s, received_kind, kind); +netdev_enter_failed(netdev); +return r; +} } netdev-ifindex = ifindex; @@ -612,14 +623,16 @@ static int netdev_load_one(Manager *manager, const char *filename
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/24/2014 10:05 PM, Ronny Chevalier wrote: 2014-06-24 18:25 GMT+02:00 Susant Sahani sus...@redhat.com: This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Mode=tap OneQueue=true MultiQueue=true PacketInfo=true Added: 1. file networkd-tuntap.c 2. enum TunTapKind 3. NETDEV_KIND_TUNTAP 4. TUNTAP Section to parse conf and gperf conf parameters TODO: 1. Add user(uid) group(gid) parameters --- Makefile.am | 1 + src/network/networkd-netdev-gperf.gperf | 4 ++ src/network/networkd-netdev.c | 40 +--- src/network/networkd-tuntap.c | 106 src/network/networkd.h | 19 ++ 5 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 src/network/networkd-tuntap.c diff --git a/Makefile.am b/Makefile.am index 37a164e..d9cba3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4479,6 +4479,7 @@ libsystemd_networkd_core_la_SOURCES = \ src/network/networkd-tunnel.c \ src/network/networkd-veth.c \ src/network/networkd-vxlan.c \ + src/network/networkd-tuntap.c \ src/network/networkd-network.c \ src/network/networkd-address.c \ src/network/networkd-route.c \ diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 9125e1d..d29e41d 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -38,3 +38,7 @@ VXLAN.Group, config_parse_tunnel_address, 0, VXLAN.TOS, config_parse_unsigned, 0, offsetof(NetDev, tos) VXLAN.TTL, config_parse_unsigned, 0, offsetof(NetDev, ttl) VXLAN.MacLearning, config_parse_bool, 0, offsetof(NetDev, learning) +TUNTAP.Mode, config_parse_tuntap_kind, 0, offsetof(NetDev, tuntap_kind) +TUNTAP.OneQueue, config_parse_bool, 0, offsetof(NetDev, one_queue) +TUNTAP.MultiQueue, config_parse_bool, 0, offsetof(NetDev, multi_queue) +TUNTAP.PacketInfo, config_parse_bool, 0, offsetof(NetDev, packet_info) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index dcf7596..41db707 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -41,7 +41,8 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = { [NETDEV_KIND_GRE] = gre, [NETDEV_KIND_SIT] = sit, [NETDEV_KIND_VETH] = veth, -[NETDEV_KIND_VTI] = vti +[NETDEV_KIND_VTI] = vti, +[NETDEV_KIND_TUNTAP] = tuntap }; DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); @@ -57,6 +58,14 @@ static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode); DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, Failed to parse macvlan mode); +static const char* const tuntap_kind_table[_TUNTAP_KIND_MAX] = { +[TUNTAP_KIND_TAP] = tap, +[TUNTAP_KIND_TUNNEL] = tunnel, +}; + +DEFINE_STRING_TABLE_LOOKUP(tuntap_kind, TunTapKind); +DEFINE_CONFIG_PARSE_ENUM(config_parse_tuntap_kind, tuntap_kind, TunTapKind, Failed to parse tuntap kind); + static void netdev_cancel_callbacks(NetDev *netdev) { _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL; netdev_enslave_callback *callback; @@ -521,11 +530,13 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { return -EINVAL; } -if (!streq(kind, received_kind)) { -log_error_netdev(netdev, Received newlink with wrong KIND %s, - expected %s, received_kind, kind); -netdev_enter_failed(netdev); -return r; +if (netdev-kind != NETDEV_KIND_TUNTAP) { +if (!streq(kind, received_kind)) { +log_error_netdev(netdev, Received newlink with wrong KIND %s, + expected %s, received_kind, kind); +netdev_enter_failed(netdev); +return r; +} } netdev-ifindex = ifindex; @@ -612,14 +623,16 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev-manager = manager; netdev-state = _NETDEV_STATE_INVALID; netdev-kind = _NETDEV_KIND_INVALID; +netdev-tuntap_kind = _TUNTAP_KIND_INVALID; netdev-macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID; netdev-vlanid = VLANID_MAX + 1
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/25/2014 02:21 PM, Lennart Poettering wrote: On Tue, 24.06.14 23:21, Susant Sahani (sus...@redhat.com) wrote: This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Hm, maybe call this TunTap instead? Mode=tap OneQueue=true MultiQueue=true PacketInfo=true I wonder if it might be better separate in Tun and in Tap devices. Tun devices are IP only devices and Tap devices are actual Ethernet devices. It looks a bit silly that you have to specific Kind=tuntap only to later specific Mode=tap. Why not just do Kind=tap device? That under Linux the setup of both Tun and Tap devices happens via /dev/net/tun is just an implementation detail. The intention behind keeping Kind=tuntap is related to the driver. Kind - driver Mode- how it behaves . Of cource what you saying is correct implementation details but Kind is related to the driver. I fully agree with Marcel. We shouldn't expose users too directly to implementation details of the kernel. The fact that usually the Kind maps to the low-level driver doesn't mean we have to map it always 1:1. In this case it really makes more sense to map one driver (tuntap) into two different Kinds (tun + tap). We can abstract that Agreed . Lennart -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/25/2014 02:51 PM, Susant Sahani wrote: On 06/25/2014 02:21 PM, Lennart Poettering wrote: On Tue, 24.06.14 23:21, Susant Sahani (sus...@redhat.com) wrote: This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Do we need to keep this section different as well ? for example [Tun] and [Tap] Hm, maybe call this TunTap instead? Mode=tap OneQueue=true MultiQueue=true PacketInfo=true I wonder if it might be better separate in Tun and in Tap devices. Tun devices are IP only devices and Tap devices are actual Ethernet devices. It looks a bit silly that you have to specific Kind=tuntap only to later specific Mode=tap. Why not just do Kind=tap device? That under Linux the setup of both Tun and Tap devices happens via /dev/net/tun is just an implementation detail. The intention behind keeping Kind=tuntap is related to the driver. Kind - driver Mode- how it behaves . Of cource what you saying is correct implementation details but Kind is related to the driver. I fully agree with Marcel. We shouldn't expose users too directly to implementation details of the kernel. The fact that usually the Kind maps to the low-level driver doesn't mean we have to map it always 1:1. In this case it really makes more sense to map one driver (tuntap) into two different Kinds (tun + tap). We can abstract that Agreed . Lennart -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: Introduce tuntap device
On 06/25/2014 03:28 PM, Tom Gundersen wrote: On Wed, Jun 25, 2014 at 11:38 AM, Susant Sahani sus...@redhat.com wrote: On 06/25/2014 02:51 PM, Susant Sahani wrote: On 06/25/2014 02:21 PM, Lennart Poettering wrote: On Tue, 24.06.14 23:21, Susant Sahani (sus...@redhat.com) wrote: This patch introduces tuntap support to networkd. Example conf file : tuntap.netdev [NetDev] Name=tuntap-test Kind=tuntap [TUNTAP] Do we need to keep this section different as well ? for example [Tun] and [Tap] Yeah, I'd keep it separate (user should not know that it is the same internally). Thanks Tom . -t ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Introduce tun/tap device
, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, false, false, netdev); if (r 0) { @@ -719,6 +731,14 @@ static int netdev_load_one(Manager *manager, const char *filename) { if (r 0) return r; break; + +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +r = netdev_create_tuntap(netdev); +if (r 0) +return r; +break; + default: break; } diff --git a/src/network/networkd-tuntap.c b/src/network/networkd-tuntap.c new file mode 100644 index 000..7c1840c --- /dev/null +++ b/src/network/networkd-tuntap.c @@ -0,0 +1,101 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** +This file is part of systemd. + +Copyright 2014 Susant Sahani sus...@redhat.com + +systemd is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +systemd is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include sys/ioctl.h +#include net/if.h +#include linux/if_tun.h + +#include networkd.h + +#define TUN_DEV /dev/net/tun + + +static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { + +assert(netdev); +assert(ifr); + +memset(ifr, 0, sizeof(*ifr)); + +if(netdev-kind != NETDEV_KIND_TAP) +ifr-ifr_flags |= IFF_TUN; +else +ifr-ifr_flags |= IFF_TAP; + +if(!netdev-packet_info) +ifr-ifr_flags = ~IFF_NO_PI; +else +ifr-ifr_flags |= IFF_NO_PI; + +if(netdev-one_queue) +ifr-ifr_flags |= IFF_ONE_QUEUE; + +if(netdev-multi_queue) +ifr-ifr_flags |= IFF_MULTI_QUEUE; + +strncpy(ifr-ifr_name, netdev-ifname, IFNAMSIZ-1); + +return 0; +} + +static int netdev_tuntap_add(struct ifreq *ifr) { +_cleanup_close_ int fd; +int r = 0; + +fd = open(TUN_DEV, O_RDWR); +if (fd 0) +return -errno; + +r = ioctl(fd, TUNSETIFF, ifr); +if (r 0) +return -errno; + +r = ioctl(fd, TUNSETPERSIST, 1); +if (r 0) +return -errno; + +return r; +} + +int netdev_create_tuntap(NetDev *netdev) { +struct ifreq ifr; +int r; + +assert(netdev); +assert(netdev-ifname); + +switch(netdev-kind) { +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +break; +default: +return -ENOTSUP; +} + +r = netdev_fill_tuntap_message(netdev, ifr); +if(r 0) +return r; + +log_debug_netdev(netdev, Creating tuntap netdev: %s, + netdev_kind_to_string(netdev-kind)); + +return netdev_tuntap_add(ifr); +} diff --git a/src/network/networkd.h b/src/network/networkd.h index b7b1d90..7f24635 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -80,6 +80,8 @@ typedef enum NetDevKind { NETDEV_KIND_SIT, NETDEV_KIND_VETH, NETDEV_KIND_VTI, +NETDEV_KIND_TUN, +NETDEV_KIND_TAP, _NETDEV_KIND_MAX, _NETDEV_KIND_INVALID = -1 } NetDevKind; @@ -122,6 +124,10 @@ struct NetDev { bool tunnel_pmtudisc; bool learning; +bool one_queue; +bool multi_queue; +bool packet_info; + unsigned ttl; unsigned tos; struct in_addr local; @@ -342,6 +348,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb); int netdev_create_tunnel(Link *link, sd_rtnl_message_handler_t callback); int netdev_create_veth(NetDev *netdev, sd_rtnl_message_handler_t callback); int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback); +int netdev_create_tuntap(NetDev *netdev); const char *netdev_kind_to_string(NetDevKind d) _const_; NetDevKind netdev_kind_from_string(const char *d) _pure_; @@ -353,6 +360,8 @@ int config_parse_netdev_kind(const char *unit, const char *filename, unsigned li int config_parse_macvlan_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_tuntap_kind(const char *unit, const char *filename, unsigned line, const char *section, unsigned
Re: [systemd-devel] SIT tunnel does not work
On 06/25/2014 04:50 PM, Tomasz Torcz wrote: On Sat, Jun 21, 2014 at 04:36:45PM +0530, Susant Sahani wrote: On 06/21/2014 02:47 PM, Tomasz Torcz wrote: Hi, I've tried to establish SIT tunnel to Hurricane Electric, using systemd v214. It does not work, device do not appear. I'm concerned about networkd discarding part of netlink messages, see below. Original instruction is provided by HE, rest is my shot at translating it into netdev (nb. manpage wasn't updated when tunnel features went in). The se.network file has conf problem. you need to put the interface name rather tunnel name like eth0/em1 Original instruction: - modprobe ipv6 ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local 109.107.25.67 ttl 255 ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local dev eth0 The local IP part comes directly from HE instructionpage. And it works, which is not the case for local dev eth0 version: $ ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local dev eth0 Error: an IP address is expected rather than dev The intention is that we need to the dev . Yes I missed providing the ipaddr. $ rpm -qf /usr/sbin/ip iproute-3.15.0-1.fc21.x86_64 (adding dev works if I ALSO provide local ip part: ip tunnel add he-ipv6 mode sit remote 216.66.80.162 local 109.107.25.67 ttl 255 dev eth0 ) ip link set he-ipv6 up ip addr add 2001:470:70:68d::2/64 dev he-ipv6 ip route add ::/0 dev he-ipv6 ip -f inet6 addr $ cat he.netdev --- [NetDev] Name=he Kind=sit [Tunnel] Local=109.107.25.67 Remote=216.66.80.162 $ cat he.network [Match] Name=he you need to supply the interface name here [Match] Name=em1 ==interface name After putting in interface name tunnel is still not created: could send do ip link output. # SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd timestamp of '/etc/systemd/network' changed he: loaded sit sd-rtnl: discarding 20 bytes of incoming message could not add new link And no more lines mentioning neither tunnel nor he. -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Introduce tun/tap device
, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, false, false, netdev); if (r 0) { @@ -719,6 +731,14 @@ static int netdev_load_one(Manager *manager, const char *filename) { if (r 0) return r; break; + +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +r = netdev_create_tuntap(netdev); +if (r 0) +return r; +break; + default: break; } diff --git a/src/network/networkd-tuntap.c b/src/network/networkd-tuntap.c new file mode 100644 index 000..69a77f2 --- /dev/null +++ b/src/network/networkd-tuntap.c @@ -0,0 +1,101 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** +This file is part of systemd. + +Copyright 2014 Susant Sahani sus...@redhat.com + +systemd is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +systemd is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include sys/ioctl.h +#include net/if.h +#include linux/if_tun.h + +#include networkd.h + +#define TUN_DEV /dev/net/tun + + +static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { + +assert(netdev); +assert(ifr); + +memset(ifr, 0, sizeof(*ifr)); + +if (netdev-kind != NETDEV_KIND_TAP) +ifr-ifr_flags |= IFF_TUN; +else +ifr-ifr_flags |= IFF_TAP; + +if (netdev-packet_info) +ifr-ifr_flags |= IFF_NO_PI; +else +ifr-ifr_flags = ~IFF_NO_PI; + +if (netdev-one_queue) +ifr-ifr_flags |= IFF_ONE_QUEUE; + +if (netdev-multi_queue) +ifr-ifr_flags |= IFF_MULTI_QUEUE; + +strncpy(ifr-ifr_name, netdev-ifname, IFNAMSIZ-1); + +return 0; +} + +static int netdev_tuntap_add(struct ifreq *ifr) { +_cleanup_close_ int fd; +int r = 0; + +fd = open(TUN_DEV, O_RDWR); +if (fd 0) +return -errno; + +r = ioctl(fd, TUNSETIFF, ifr); +if (r 0) +return -errno; + +r = ioctl(fd, TUNSETPERSIST, 1); +if (r 0) +return -errno; + +return r; +} + +int netdev_create_tuntap(NetDev *netdev) { +struct ifreq ifr; +int r; + +assert(netdev); +assert(netdev-ifname); + +switch(netdev-kind) { +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +break; +default: +return -ENOTSUP; +} + +r = netdev_fill_tuntap_message(netdev, ifr); +if(r 0) +return r; + +log_debug_netdev(netdev, Creating tuntap netdev: %s, + netdev_kind_to_string(netdev-kind)); + +return netdev_tuntap_add(ifr); +} diff --git a/src/network/networkd.h b/src/network/networkd.h index 11268de..f943a10 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -81,6 +81,8 @@ typedef enum NetDevKind { NETDEV_KIND_SIT, NETDEV_KIND_VETH, NETDEV_KIND_VTI, +NETDEV_KIND_TUN, +NETDEV_KIND_TAP, _NETDEV_KIND_MAX, _NETDEV_KIND_INVALID = -1 } NetDevKind; @@ -123,6 +125,10 @@ struct NetDev { bool tunnel_pmtudisc; bool learning; +bool one_queue; +bool multi_queue; +bool packet_info; + unsigned ttl; unsigned tos; struct in_addr local; @@ -352,6 +358,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb); int netdev_create_tunnel(Link *link, sd_rtnl_message_handler_t callback); int netdev_create_veth(NetDev *netdev, sd_rtnl_message_handler_t callback); int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback); +int netdev_create_tuntap(NetDev *netdev); const char *netdev_kind_to_string(NetDevKind d) _const_; NetDevKind netdev_kind_from_string(const char *d) _pure_; -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: Introduce tun/tap device
On 06/25/2014 07:12 PM, Zbigniew Jędrzejewski-Szmek wrote: -[NETDEV_KIND_VTI] = vti +[NETDEV_KIND_VTI] = vti, +[NETDEV_KIND_TUN] = tun, +[NETDEV_KIND_TAP] = tap - Maybe add a comma here, to makes future patches simpler }; DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); @@ -221,6 +223,7 @@ static int netdev_enter_ready(NetDev *netdev) { return 0; } + static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { NetDev *netdev = userdata; int r; @@ -521,11 +524,19 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { return -EINVAL; } -if (!streq(kind, received_kind)) { -log_error_netdev(netdev, Received newlink with wrong KIND %s, - expected %s, received_kind, kind); -netdev_enter_failed(netdev); -return r; +switch(netdev-kind) { +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +break; +default: +if (!streq(kind, received_kind)) { +log_error_netdev(netdev, + Received newlink with wrong KIND %s, + expected %s, received_kind, kind); +netdev_enter_failed(netdev); +return r; +} +break; } netdev-ifindex = ifindex; @@ -617,9 +628,10 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev-vxlanid = VXLAN_VID_MAX + 1; netdev-tunnel_pmtudisc = true; netdev-learning = true; +netdev-packet_info = true; r = config_parse(NULL, filename, file, - Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0, + Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0Tun\0Tap\0, config_item_perf_lookup, (void*) network_netdev_gperf_lookup, false, false, netdev); if (r 0) { @@ -719,6 +731,14 @@ static int netdev_load_one(Manager *manager, const char *filename) { if (r 0) return r; break; + +case NETDEV_KIND_TUN: +case NETDEV_KIND_TAP: +r = netdev_create_tuntap(netdev); +if (r 0) +return r; +break; + default: break; } diff --git a/src/network/networkd-tuntap.c b/src/network/networkd-tuntap.c new file mode 100644 index 000..7c1840c --- /dev/null +++ b/src/network/networkd-tuntap.c @@ -0,0 +1,101 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** +This file is part of systemd. + +Copyright 2014 Susant Sahani sus...@redhat.com + +systemd is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +systemd is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include sys/ioctl.h +#include net/if.h +#include linux/if_tun.h + +#include networkd.h + +#define TUN_DEV /dev/net/tun + + +static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) { + +assert(netdev); +assert(ifr); + +memset(ifr, 0, sizeof(*ifr)); +if(netdev-kind != NETDEV_KIND_TAP) +ifr-ifr_flags |= IFF_TUN; +else +ifr-ifr_flags |= IFF_TAP; + +if(!netdev-packet_info) +ifr-ifr_flags = ~IFF_NO_PI; +else +ifr-ifr_flags |= IFF_NO_PI; Can the conditions in two if's above be reverted? It is easier to read true conditions than !false. Also add space between if and (. /* gperf */ const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsigned length); Look good. Zbyszek Addressed all the comments thanks . -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: Introduce tun/tap device
On 06/30/2014 11:03 PM, Lennart Poettering wrote: On Mon, 30.06.14 22:23, Susant Sahani (sus...@redhat.com) wrote: This patch introduces TUN/TAP device creation support to networkd. Please always also include the updates to the respective man pages that document these settings in these patches! THanks! Sure thanks . Lennart -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] conf parser: introduce milisecond parsing
On 07/16/2014 01:07 PM, Susant Sahani wrote: Add millisecord parsing support to conf parser. Immediate usage of this function is to parse bond options such as MIIMonitor, UpDelayMSec, DownDelayMSec which is represented in milli seconds. Dropped the idea . Please ignore the patch. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] socket: Introduce SCTP support
This patch adds SCTP protcol support for socket activation. SCTP socket can be configured via the conf parameter 'ListenStreamControlTrans' which is kind of too long. --- man/systemd.socket.xml| 3 ++- src/core/load-fragment-gperf.gperf.m4 | 1 + src/core/load-fragment.c | 5 - src/core/socket.c | 8 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index ddd74a6..934a45e 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -168,10 +168,11 @@ termvarnameListenStream=/varname/term termvarnameListenDatagram=/varname/term termvarnameListenSequentialPacket=/varname/term + termvarnameListenStreamControlTrans=/varname/term listitemparaSpecifies an address to listen on for a stream (constantSOCK_STREAM/constant), datagram (constantSOCK_DGRAM/constant), -or sequential packet +SCTP (constantIPPROTO_SCTP/constant),or sequential packet (constantSOCK_SEQPACKET/constant) socket, respectively. The address can be written in various formats:/para diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index f4acdda..a295923 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -211,6 +211,7 @@ KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl m4_dnl Socket.ListenStream, config_parse_socket_listen, SOCKET_SOCKET, 0 Socket.ListenDatagram, config_parse_socket_listen, SOCKET_SOCKET, 0 +Socket.ListenStreamControlTrans, config_parse_socket_listen, SOCKET_SOCKET, 0 Socket.ListenSequentialPacket, config_parse_socket_listen, SOCKET_SOCKET, 0 Socket.ListenFIFO, config_parse_socket_listen, SOCKET_FIFO, 0 Socket.ListenNetlink,config_parse_socket_listen, SOCKET_SOCKET, 0 diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 81f1379..0ae116b 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -358,7 +358,10 @@ int config_parse_socket_listen(const char *unit, p-address.type = SOCK_STREAM; else if (streq(lvalue, ListenDatagram)) p-address.type = SOCK_DGRAM; -else { +else if (streq(lvalue, ListenStreamControlTrans)) { + p-address.type = SOCK_STREAM; + p-address.protocol = IPPROTO_SCTP; +} else { assert(streq(lvalue, ListenSequentialPacket)); p-address.type = SOCK_SEQPACKET; } diff --git a/src/core/socket.c b/src/core/socket.c index 7070bd7..82d8eaf 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -445,11 +445,14 @@ static int socket_load(Unit *u) { return socket_verify(s); } -_const_ static const char* listen_lookup(int family, int type) { +_const_ static const char* listen_lookup(int family, int type, int protocol) { if (family == AF_NETLINK) return ListenNetlink; +if (protocol == IPPROTO_SCTP) +return ListenStreamControlTrans; + if (type == SOCK_STREAM) return ListenStream; else if (type == SOCK_DGRAM) @@ -607,7 +610,8 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { else t = k; -fprintf(f, %s%s: %s\n, prefix, listen_lookup(socket_address_family(p-address), p-address.type), t); +fprintf(f, %s%s: %s\n, prefix, listen_lookup(socket_address_family(p-address), + p-address.type, p-address.protocol), t); free(k); } else if (p-type == SOCKET_SPECIAL) fprintf(f, %sListenSpecial: %s\n, prefix, p-path); -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] socket: add support for tcp nagle
This patch adds support for TCP TCP_NODELAY socket option. This can be configured via NoDelay conf parameter.TCP Nagle's algorithm works by combining a number of small outgoing messages, and sending them all at once. This controls the TCP_NODELAY socket option --- man/systemd.socket.xml| 11 +++ src/core/load-fragment-gperf.gperf.m4 | 1 + src/core/socket.c | 8 src/core/socket.h | 1 + 4 files changed, 21 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 09a7311..ddd74a6 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -488,6 +488,17 @@ /varlistentry varlistentry +termvarnameNoDelay=/varname/term +listitemparaTakes a boolean +argument. TCP Nagle's algorithm works by combining a number of +small outgoing messages, and sending them all at once. +This controls the TCP_NODELAY socket option (see + citerefentryrefentrytitletcp/refentrytitlemanvolnum7/manvolnum/citerefentry +Defaults to +optionfalse/option./para/listitem +/varlistentry + +varlistentry termvarnamePriority=/varname/term listitemparaTakes an integer argument controlling the priority for diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index d70f9ee..f4acdda 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -231,6 +231,7 @@ Socket.DirectoryMode,config_parse_mode, 0, Socket.Accept, config_parse_bool, 0, offsetof(Socket, accept) Socket.MaxConnections, config_parse_unsigned, 0, offsetof(Socket, max_connections) Socket.KeepAlive,config_parse_bool, 0, offsetof(Socket, keep_alive) +Socket.NoDelay, config_parse_bool, 0, offsetof(Socket, no_delay) Socket.Priority, config_parse_int, 0, offsetof(Socket, priority) Socket.ReceiveBuffer,config_parse_iec_size, 0, offsetof(Socket, receive_buffer) Socket.SendBuffer, config_parse_iec_size, 0, offsetof(Socket, send_buffer) diff --git a/src/core/socket.c b/src/core/socket.c index 646887d..7070bd7 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -480,6 +480,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { %sSocketMode: %04o\n %sDirectoryMode: %04o\n %sKeepAlive: %s\n +%sNodelay: %s\n %sFreeBind: %s\n %sTransparent: %s\n %sBroadcast: %s\n @@ -494,6 +495,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { prefix, s-socket_mode, prefix, s-directory_mode, prefix, yes_no(s-keep_alive), +prefix, yes_no(s-no_delay), prefix, yes_no(s-free_bind), prefix, yes_no(s-transparent), prefix, yes_no(s-broadcast), @@ -790,6 +792,12 @@ static void socket_apply_socket_options(Socket *s, int fd) { log_warning_unit(UNIT(s)-id, SO_KEEPALIVE failed: %m); } +if (s-no_delay) { +int b = s-no_delay; +if (setsockopt(fd, SOL_TCP, TCP_NODELAY, b, sizeof(b)) 0) +log_warning_unit(UNIT(s)-id, TCP_NODELAY failed: %m); +} + if (s-broadcast) { int one = 1; if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, one, sizeof(one)) 0) diff --git a/src/core/socket.h b/src/core/socket.h index 814a3bf..98396e7 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -134,6 +134,7 @@ struct Socket { /* Socket options */ bool keep_alive; +bool no_delay; bool free_bind; bool transparent; bool broadcast; -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 3/3] socket: Add support for TCP defer accept
TCP_DEFER_ACCEPT Allow a listener to be awakened only when data arrives on the socket. If TCP_DEFER_ACCEPT set on a server-side listening socket, the TCP/IP stack will not to wait for the final ACK packet and not to initiate the process until the first packet of real data has arrived. After sending the SYN/ACK, the server will then wait for a data packet from a client. Now, only three packets will be sent over the network, and the connection establishment delay will be significantly reduced. --- man/systemd.socket.xml | 16 src/core/dbus-socket.c | 1 + src/core/socket.c | 11 +++ src/core/socket.h | 1 + 4 files changed, 29 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index e6bbb2e..9ce94aa 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -539,6 +539,22 @@ /varlistentry varlistentry +termvarnameDeferAccept=/varname/term +listitemparaTakes time (in seconds) as argument +Allow a listener to be awakened only when data arrives on the socket. +If TCP_DEFER_ACCEPT set on a server-side listening socket, +the TCP/IP stack will not to wait for the final ACK packet and not to +initiate the process until the first packet of real data has arrived. +After sending the SYN/ACK, the server will then wait for a data packet +from a client. Now, only three packets will be sent over the network, +and the connection establishment delay will be significantly reduced. +This controls the TCP_DEFER_ACCEPT socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry +Defaults to +optiondisabled/option./para/listitem +/varlistentry + +varlistentry termvarnamePriority=/varname/term listitemparaTakes an integer argument controlling the priority for diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index f9ef7ef..1142ca5 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -101,6 +101,7 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(FastOpen , b, bus_property_get_bool, offsetof(Socket, fast_open), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(DeferAccept , t, bus_property_get_usec, offsetof(Socket, defer_accept), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(SendBuffer, t, bus_property_get_size, offsetof(Socket, send_buffer), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/socket.c b/src/core/socket.c index b798d4e..32cadf9 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -610,6 +610,11 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { %sKeepAliveProbes: %u\n, prefix, s-keep_alive_cnt); +if(s-defer_accept) +fprintf(f, +%sDeferAccept: %lo\n, +prefix, s-defer_accept / USEC_PER_SEC); + LIST_FOREACH(port, p, s-ports) { if (p-type == SOCKET_SOCKET) { @@ -831,6 +836,12 @@ static void socket_apply_socket_options(Socket *s, int fd) { log_warning_unit(UNIT(s)-id, TCP_FASTOPEN failed: %m); } +if (s-defer_accept) { +int value = s-defer_accept / USEC_PER_SEC; +if (setsockopt(fd, SOL_TCP, TCP_DEFER_ACCEPT, value, sizeof(value)) 0) +log_warning_unit(UNIT(s)-id, TCP_DEFER_ACCEPT failed: %m); +} + if (s-broadcast) { int one = 1; if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, one, sizeof(one)) 0) diff --git a/src/core/socket.h b/src/core/socket.h index 9cb82fa..7452d27 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -104,6 +104,7 @@ struct Socket { usec_t timeout_usec; usec_t keep_alive_time; usec_t keep_alive_interval; +usec_t defer_accept;
[systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables
The tcp keep alive variables now can be configured via conf parameter. Follwing variables are now supported by this patch. tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes tcp_keepalive_probes: The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end. tcp_keepalive_time: The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. --- man/systemd.socket.xml| 36 +++ src/core/dbus-socket.c| 3 +++ src/core/load-fragment-gperf.gperf.m4 | 3 +++ src/core/socket.c | 33 src/core/socket.h | 3 +++ 5 files changed, 78 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 09a7311..6dbcc81 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -488,6 +488,42 @@ /varlistentry varlistentry + termvarnameKeepAliveTime=/varname/term + listitemparaTakes time (in seconds) as argument . The connection needs to remain + idle before TCP starts sending keepalive probes. This controls the TCP_KEEPIDLE + socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry + and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP + Keepalive HOWTO/ulink for details.) + Defaults value is 7200 seconds (2 hours)./para/listitem +/varlistentry + +varlistentry + termvarnameKeepAliveInterval=/varname/term + listitemparaTakes time (in seconds) as argument between individual keepalive probes, + if the socket option SO_KEEPALIVE has been set on this socket seconds as argument. + This controls the TCP_KEEPINTVL socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry + and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP + Keepalive HOWTO/ulink for details.) + Defaults value is 75 seconds./para/listitem +/varlistentry + +varlistentry + termvarnameKeepAliveProbes=/varname/term + listitemparaTakes interger as argument. It's the number of unacknowledged probes to + send before considering the connection dead and notifying the application layer. + This controls the TCP_KEEPCNT socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry + and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP + Keepalive HOWTO/ulink for details.) + Defaults value is 9./para/listitem +/varlistentry + +varlistentry termvarnamePriority=/varname/term listitemparaTakes an integer argument controlling the priority for diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index ad135a1..348afbd 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -97,6 +97,9 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(DirectoryMode, u, bus_property_get_mode, offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Accept, b, bus_property_get_bool, offsetof(Socket, accept), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAlive, b, bus_property_get_bool, offsetof(Socket, keep_alive), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(SendBuffer,
Re: [systemd-devel] [PATCH 2/2] socket: Introduce SCTP support
On 08/04/2014 06:26 PM, Lennart Poettering wrote: On Mon, 28.07.14 12:18, Susant Sahani (sus...@redhat.com) wrote: This patch adds SCTP protcol support for socket activation. SCTP socket can be configured via the conf parameter 'ListenStreamControlTrans' which is kind of too long. Hmm, shouldn't it suffice opening up ListenSequentialPacket= for IP sockets? Currently, we explicitly don't dallow that, but doesn't socket(AF_INET, SOCK_SEQPACKET, 0) result in an SCTP socket these days? That is correct . I should have written using SOCK_STREAM. My Mistake. Can we make the protocol field configurable for this ? Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] socket: add support for TCP fast Open
TCP Fast Open (TFO) speeds up the opening of successiveTCP) connections between two endpoints.It works by using a TFO cookie in the initial SYN packet to authenticate a previously connected client. It starts sending data to the client before the receipt of the final ACK packet of the three way handshake is received, skipping a round trip and lowering the latency in the start of transmission of data. --- man/systemd.socket.xml| 15 +++ src/core/dbus-socket.c| 1 + src/core/load-fragment-gperf.gperf.m4 | 1 + src/core/socket.c | 8 src/core/socket.h | 1 + 5 files changed, 26 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 352825f..170d010 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -499,6 +499,21 @@ /varlistentry varlistentry +termvarnameFastOpen=/varname/term +listitemparaTakes a boolean +argument. It works by using a TFO cookie (a TCP option) in the initial +SYN packet to authenticate a previously connected client. If successful, +it may start sending data to the client before the receipt of the final +ACK packet of the three way handshake is received, skipping a round trip +and lowering the latency in the start of transmission of data. +This controls the TCP_FASTOPEN socket option (see +the ulink url=http://lwn.net/Articles/508865/;TCP +Fast Open: expediting web services/ulink for details.) +Defaults to +optionfalse/option./para/listitem +/varlistentry + +varlistentry termvarnamePriority=/varname/term listitemparaTakes an integer argument controlling the priority for diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index ad135a1..71c0115 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -97,6 +97,7 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(DirectoryMode, u, bus_property_get_mode, offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Accept, b, bus_property_get_bool, offsetof(Socket, accept), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAlive, b, bus_property_get_bool, offsetof(Socket, keep_alive), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(FastOpen , b, bus_property_get_bool, offsetof(Socket, fast_open), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(SendBuffer, t, bus_property_get_size, offsetof(Socket, send_buffer), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index f4acdda..08d0593 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -232,6 +232,7 @@ Socket.Accept, config_parse_bool, 0, Socket.MaxConnections, config_parse_unsigned, 0, offsetof(Socket, max_connections) Socket.KeepAlive,config_parse_bool, 0, offsetof(Socket, keep_alive) Socket.NoDelay, config_parse_bool, 0, offsetof(Socket, no_delay) +Socket.FastOpen, config_parse_bool, 0, offsetof(Socket, fast_open) Socket.Priority, config_parse_int, 0, offsetof(Socket, priority) Socket.ReceiveBuffer,config_parse_iec_size, 0, offsetof(Socket, receive_buffer) Socket.SendBuffer, config_parse_iec_size, 0, offsetof(Socket, send_buffer) diff --git a/src/core/socket.c b/src/core/socket.c index 5af1596..44827ad 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -481,6 +481,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { %sDirectoryMode: %04o\n %sKeepAlive: %s\n %sNoDelay: %s\n +%sFastOpen: %s\n %sFreeBind: %s\n %sTransparent: %s\n
Re: [systemd-devel] [PATCH 2/3] socket: Add support for TCP Fast Open
Hi Lennart, On 08/14/2014 06:16 AM, Lennart Poettering wrote: On Tue, 29.07.14 23:10, Susant Sahani (sus...@redhat.com) wrote: Looks good. Wanted to apply. But this requires your previous patch, so please rebase on a new version of that! Thanks! Since this patch does not depend on the other patches I merged it with the current code. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables
On 08/14/2014 06:13 AM, Lennart Poettering wrote: On Tue, 29.07.14 23:10, Susant Sahani (sus...@redhat.com) wrote: tcp_keepalive_time: The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. Looks pretty OK. --- varlistentry + termvarnameKeepAliveTime=/varname/term + listitemparaTakes time (in seconds) as argument . The connection needs to remain ^ there's a spurious space too much here... Removed . + idle before TCP starts sending keepalive probes. This controls the TCP_KEEPIDLE + socket option (see +/varlistentry Could you indent this like the rest of the settings, please? Ok +SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), This should really be an u and use bus_property_get_unsigned(), no? I mean, there is no negative count possible, is there? Yes :) +if(s-keep_alive_time) +fprintf(f, +%sKeepAliveTime: %lo\n, +prefix, s-keep_alive_time / USEC_PER_SEC); Please format this with format_timespan()! made the changes Otherwise looks good! Lennart Re-sending Both the patches . Thanks for reviewing. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables
The tcp keep alive variables now can be configured via conf parameter. Follwing variables are now supported by this patch. tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes tcp_keepalive_probes: The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end. tcp_keepalive_time: The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. --- man/systemd.socket.xml| 36 +++ src/core/dbus-socket.c| 3 +++ src/core/load-fragment-gperf.gperf.m4 | 3 +++ src/core/socket.c | 36 +++ src/core/socket.h | 3 +++ 5 files changed, 81 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 352825f..5efb398 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -488,6 +488,42 @@ /varlistentry varlistentry +termvarnameKeepAliveTime=/varname/term +listitemparaTakes time (in seconds) as argument . The connection needs to remain +idle before TCP starts sending keepalive probes. This controls the TCP_KEEPIDLE +socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry +and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP +Keepalive HOWTO/ulink for details.) +Defaults value is 7200 seconds (2 hours)./para/listitem +/varlistentry + +varlistentry + termvarnameKeepAliveInterval=/varname/term +listitemparaTakes time (in seconds) as argument between individual keepalive probes, +if the socket option SO_KEEPALIVE has been set on this socket seconds as argument. +This controls the TCP_KEEPINTVL socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry +and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP +Keepalive HOWTO/ulink for details.) +Defaults value is 75 seconds./para/listitem +/varlistentry + +varlistentry + termvarnameKeepAliveProbes=/varname/term +listitemparaTakes interger as argument. It's the number of unacknowledged probes to +send before considering the connection dead and notifying the application layer. +This controls the TCP_KEEPCNT socket option (see + citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry +and the ulink + url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP +Keepalive HOWTO/ulink for details.) +Defaults value is 9./para/listitem +/varlistentry + +varlistentry termvarnameNoDelay=/varname/term listitemparaTakes a boolean argument. TCP Nagle's algorithm works by combining a number of diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index ad135a1..bdf111c 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -97,6 +97,9 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(DirectoryMode, u, bus_property_get_mode, offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Accept, b, bus_property_get_bool, offsetof(Socket, accept), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAlive, b, bus_property_get_bool, offsetof(Socket, keep_alive), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(KeepAliveProbes, u, bus_property_get_unsigned, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority),
[systemd-devel] [PATCH 2/3] socket: Add support for TCP defer accept
TCP_DEFER_ACCEPT Allow a listener to be awakened only when data arrives on the socket. If TCP_DEFER_ACCEPT set on a server-side listening socket, the TCP/IP stack will not to wait for the final ACK packet and not to initiate the process until the first packet of real data has arrived. After sending the SYN/ACK, the server will then wait for a data packet from a client. Now, only three packets will be sent over the network, and the connection establishment delay will be significantly reduced. --- man/systemd.socket.xml| 24 src/core/dbus-socket.c| 1 + src/core/load-fragment-gperf.gperf.m4 | 1 + src/core/socket.c | 12 src/core/socket.h | 1 + 5 files changed, 39 insertions(+) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 5efb398..38f16e5 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -546,6 +546,30 @@ /varlistentry varlistentry +termvarnameDeferAccept=/varname/term +listitemparaTakes time (in seconds) as argument. If set, the listening process +will be awakened only when data arrives on the socket, and not immediately +when connection is established. When this option is set, the +constantTCP_DEFER_ACCEPT/constant socket option will be used +(see + citerefentryrefentrytitletcp/refentrytitlemanvolnum7/manvolnum/citerefentry), +and the kernel will ignore initial ACK packets without any data. +The argument specifies the approximate amount +of time the kernel should wait for incoming data before falling +back to the normal behaviour of honouring empty ACK packets. +This option beneficial for protocols where the client sends the data +first (e.g. HTTP, in contrast to SMTP), because the server +process will not be woken up unnecessarily before it can take any action. +/para +paraIf the client also uses the constantTCP_DEFER_ACCEPT/constant +option, the latency of the initial connection may be +reduced, because the kernel will send data in the +final packet establishing the connection (the third packet in the +three-way handshake)./para +paraDisabled by default./para/listitem +/varlistentry + +varlistentry termvarnameReceiveBuffer=/varname/term termvarnameSendBuffer=/varname/term listitemparaTakes an integer diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index bdf111c..cc55b8d 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -100,6 +100,7 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAliveProbes, u, bus_property_get_unsigned, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(DeferAccept , t, bus_property_get_usec, offsetof(Socket, defer_accept), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(SendBuffer, t, bus_property_get_size, offsetof(Socket, send_buffer), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 67bd0e5..b4e2b25 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -234,6 +234,7 @@ Socket.KeepAlive,config_parse_bool, 0, Socket.KeepAliveTime,config_parse_sec, 0, offsetof(Socket, keep_alive_time) Socket.KeepAliveInterval,config_parse_sec, 0, offsetof(Socket, keep_alive_interval) Socket.KeepAliveProbes, config_parse_unsigned, 0,
[systemd-devel] [PATCH 3/3] socket: add bus property for bus property NoDelay
Missed to add the SD_BUS_PROPERTY for no_delay. --- src/core/dbus-socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index cc55b8d..e9e2430 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -101,6 +101,7 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(KeepAliveProbes, u, bus_property_get_unsigned, offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(DeferAccept , t, bus_property_get_usec, offsetof(Socket, defer_accept), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(NoDelay, b, bus_property_get_bool, offsetof(Socket, no_delay), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Priority, i, bus_property_get_int, offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(SendBuffer, t, bus_property_get_size, offsetof(Socket, send_buffer), SD_BUS_VTABLE_PROPERTY_CONST), -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
CID 1237543 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) --- src/socket-proxy/socket-proxyd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index ff2b24f..7b0714d 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -125,7 +125,11 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) { return -errno; } -fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +r = fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +if (r 0) { +log_error(Failed to set pipe buffer size: %m); +return -errno; +} r = fcntl(buffer[0], F_GETPIPE_SZ); if (r 0) { -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
On 09/19/2014 01:35 PM, David Herrmann wrote: Hi Hi, On Fri, Sep 19, 2014 at 9:57 AM, Susant Sahani sus...@redhat.com wrote: CID 1237543 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) --- src/socket-proxy/socket-proxyd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index ff2b24f..7b0714d 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -125,7 +125,11 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) { return -errno; } -fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +r = fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +if (r 0) { +log_error(Failed to set pipe buffer size: %m); +return -errno; +} I don't think that's right. Ignoring the return value of that fcntl is just fine. We read the buffer-size afterwards, so if it failed, we still continue properly. See fcntl(2) for a bunch of errors that might Well I think set and get are two operations. for example let's say set failed but get success. setting BUFFER_SIZE failed and in this case buf size is remained as default pipe size. happen and really shouldn't be fatal nor cause log-messages (like EBUSY if we try to _reduce_ the buffer size). Thanks David Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
On 09/19/2014 02:00 PM, David Herrmann wrote: Hi On Fri, Sep 19, 2014 at 10:28 AM, Susant Sahani sus...@redhat.com wrote: On 09/19/2014 01:35 PM, David Herrmann wrote: I don't think that's right. Ignoring the return value of that fcntl is just fine. We read the buffer-size afterwards, so if it failed, we still continue properly. See fcntl(2) for a bunch of errors that might Well I think set and get are two operations. for example let's say set failed but get success. setting BUFFER_SIZE failed and in this case buf size is remained as default pipe size. ..exactly! And the default buffer size is just fine. We'd prefer if we could set it to BUFFER_SIZE, but if we're not allowed to do that, we still continue running with the already set buffer size. yes but how about giving a log for coverity and we ignore the error ? Thanks David Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
On 09/19/2014 02:11 PM, David Herrmann wrote: Hi On Fri, Sep 19, 2014 at 10:39 AM, Alexander E. Patrakov patra...@gmail.com wrote: 19.09.2014 14:35, Susant Sahani wrote: On 09/19/2014 02:00 PM, David Herrmann wrote: Hi On Fri, Sep 19, 2014 at 10:28 AM, Susant Sahani sus...@redhat.com wrote: On 09/19/2014 01:35 PM, David Herrmann wrote: I don't think that's right. Ignoring the return value of that fcntl is just fine. We read the buffer-size afterwards, so if it failed, we still continue properly. See fcntl(2) for a bunch of errors that might Well I think set and get are two operations. for example let's say set failed but get success. setting BUFFER_SIZE failed and in this case buf size is remained as default pipe size. ..exactly! And the default buffer size is just fine. We'd prefer if we could set it to BUFFER_SIZE, but if we're not allowed to do that, we still continue running with the already set buffer size. yes but how about giving a log for coverity and we ignore the error ? How would an admin react to that log message? I'm fine with it being at the debug priority, but I am not the person who makes decisions here. Exactly! There is little point in generating those messages. Lets fix tools, not work around their bugs. Coverity should understand that ignoring ioctl() return codes is sometimes exactly what we want. So I'd prefer if we mark it as false positive. Well In this exact scenario this makes sense . Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
On 10/03/2014 12:21 AM, Lennart Poettering wrote: On Fri, 19.09.14 13:27, Susant Sahani (sus...@redhat.com) wrote: CID 1237543 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) --- src/socket-proxy/socket-proxyd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index ff2b24f..7b0714d 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -125,7 +125,11 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) { return -errno; } -fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +r = fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +if (r 0) { +log_error(Failed to set pipe buffer size: %m); +return -errno; +} If this is about making coverity shut up: doesn't coverity undestand a syntax like the following? (void) fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); I.e. by explicitly casting the result of fcntl into void, coverity should really understand that we don't really care about the result. Sorry for the late reply. Casting with void indeed works. Tested with splint. Thanks for the tip. Would be happy to take a patch for that (if coverity groks this...) Re-sending. Lennart Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] socket-proxyd: Unchecked return value from library
CID 1237543 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) --- src/socket-proxy/socket-proxyd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index ff2b24f..3041903 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -125,7 +125,7 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) { return -errno; } -fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); +(void) fcntl(buffer[0], F_SETPIPE_SZ, BUFFER_SIZE); r = fcntl(buffer[0], F_GETPIPE_SZ); if (r 0) { -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/3] resolved: fix CID 1237549 Unchecked return value
--- src/resolve/resolved-dns-scope.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 1664b13..25e0d9e 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -386,7 +386,7 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) { * one. This is necessary on some devices, such as * veth. */ if (b) -setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, mreqn, sizeof(mreqn)); +(void) setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, mreqn, sizeof(mreqn)); if (setsockopt(fd, IPPROTO_IP, b ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, mreqn, sizeof(mreqn)) 0) return -errno; @@ -402,7 +402,7 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) { return fd; if (b) -setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, mreq, sizeof(mreq)); +(void) setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, mreq, sizeof(mreq)); if (setsockopt(fd, IPPROTO_IPV6, b ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, mreq, sizeof(mreq)) 0) return -errno; -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/3] log: 1237557 Unchecked return value from library
fix 1237557 Unchecked return value from library --- src/shared/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/log.c b/src/shared/log.c index 1c589ac..e7237ba 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -122,7 +122,7 @@ static int create_log_socket(int type) { timeval_store(tv, 10 * USEC_PER_MSEC); else timeval_store(tv, 10 * USEC_PER_SEC); -setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, tv, sizeof(tv)); +(void) setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, tv, sizeof(tv)); return fd; } -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 3/3] bus-socket: fix CID 996290 Unchecked return value
--- src/libsystemd/sd-bus/bus-socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index d124d9a..662bf1c 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -610,10 +610,10 @@ void bus_socket_setup(sd_bus *b) { /* Enable SO_PASSCRED + SO_PASSEC. We try this on any * socket, just in case. */ enable = !b-bus_client; -setsockopt(b-input_fd, SOL_SOCKET, SO_PASSCRED, enable, sizeof(enable)); +(void) setsockopt(b-input_fd, SOL_SOCKET, SO_PASSCRED, enable, sizeof(enable)); enable = !b-bus_client (b-attach_flags KDBUS_ATTACH_SECLABEL); -setsockopt(b-input_fd, SOL_SOCKET, SO_PASSSEC, enable, sizeof(enable)); +(void) setsockopt(b-input_fd, SOL_SOCKET, SO_PASSSEC, enable, sizeof(enable)); /* Increase the buffers to 8 MB */ fd_inc_rcvbuf(b-input_fd, SNDBUF_SIZE); -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] namespace:Unchecked return value from library
fix: CID 1237553 (#1 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#3 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#4 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#5 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#6 of 6): Unchecked return value from library (CHECKED_RETURN) --- src/core/namespace.c | 44 +--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index 4bc288d..94a8088 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -157,14 +157,24 @@ static int mount_dev(BindMount *m) { return -errno; dev = strappenda(temporary_mount, /dev); -mkdir(dev, 0755); +r = mkdir(dev, 0755); +if (r 0) { +r = -errno; +goto fail; +} + if (mount(tmpfs, dev, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=755) 0) { r = -errno; goto fail; } devpts = strappenda(temporary_mount, /dev/pts); -mkdir(devpts, 0755); +r = mkdir(devpts, 0755); +if (r 0) { +r = -errno; +goto fail; +} + if (mount(/dev/pts, devpts, NULL, MS_BIND, NULL) 0) { r = -errno; goto fail; @@ -174,7 +184,7 @@ static int mount_dev(BindMount *m) { symlink(pts/ptmx, devptmx); devshm = strappenda(temporary_mount, /dev/shm); -mkdir(devshm, 01777); +r = mkdir(devshm, 01777); r = mount(/dev/shm, devshm, NULL, MS_BIND, NULL); if (r 0) { r = -errno; @@ -182,15 +192,30 @@ static int mount_dev(BindMount *m) { } devmqueue = strappenda(temporary_mount, /dev/mqueue); -mkdir(devmqueue, 0755); +r = mkdir(devmqueue, 0755); +if (r 0) { +r = -errno; +goto fail; +} + mount(/dev/mqueue, devmqueue, NULL, MS_BIND, NULL); devkdbus = strappenda(temporary_mount, /dev/kdbus); -mkdir(devkdbus, 0755); +r = mkdir(devkdbus, 0755); +if (r 0) { +r = -errno; +goto fail; +} + mount(/dev/kdbus, devkdbus, NULL, MS_BIND, NULL); devhugepages = strappenda(temporary_mount, /dev/hugepages); -mkdir(devhugepages, 0755); +r = mkdir(devhugepages, 0755); +if (r 0) { +r = -errno; +goto fail; +} + mount(/dev/hugepages, devhugepages, NULL, MS_BIND, NULL); devlog = strappenda(temporary_mount, /dev/log); @@ -289,7 +314,12 @@ static int mount_kdbus(BindMount *m) { } root = strappenda(temporary_mount, /kdbus); -mkdir(root, 0755); +r = mkdir(root, 0755); +if (r 0) { +r = -errno; +goto fail; +} + if (mount(tmpfs, root, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=777) 0) { r = -errno; goto fail; -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
Unchecked return value from library --- src/tty-ask-password-agent/tty-ask-password-agent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..c4cd387 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,7 +376,9 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +r = mkfifo(p, 0600); +if (r 0) +return -errno; fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (fd 0) -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Support VXlan parameters
Add vxlan paramertes to config. --- man/systemd.netdev.xml | 30 + src/network/networkd-netdev-gperf.gperf | 7 ++- src/network/networkd-netdev-vxlan.c | 75 + src/network/networkd-netdev-vxlan.h | 8 src/network/networkd.h | 11 + 5 files changed, 130 insertions(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 275ee52..e25c1c4 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -272,6 +272,36 @@ to discover remote MAC addresses./para /listitem /varlistentry +varlistentry + termvarnameFDBAgeingSec=/varname/term +listitem +paraThe lifetime of FDB entries learnt by the kernel in seconds./para +/listitem +/varlistentry +varlistentry + termvarnameARPProxy=/varname/term +listitem +paraA boolean. When true, enables ARP proxy./para +/listitem +/varlistentry +varlistentry +termvarnameL2Miss=/varname/term +listitem +paraA boolean. When true, enables netlink LLADDR miss notifications./para +/listitem +/varlistentry +varlistentry +termvarnameL3Miss=/varname/term +listitem +paraA boolean. When true, enables netlink IP ADDR miss notifications./para +/listitem +/varlistentry +varlistentry + termvarnameRouteSC=/varname/term +listitem +paraA boolean. When true route short circuit is turned on./para +/listitem +/varlistentry /variablelist /refsect1 refsect1 diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index c524ee5..5ee5380 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -37,10 +37,15 @@ Tunnel.DiscoverPathMTU, config_parse_bool, 0, Peer.Name, config_parse_ifname,0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr,0, offsetof(Veth, mac_peer) VXLAN.Id,config_parse_uint64,0, offsetof(VxLan, id) -VXLAN.Group, config_parse_tunnel_address,0, offsetof(VxLan, group) +VXLAN.Group, config_parse_vxlan_group_address, 0, offsetof(VxLan, group) VXLAN.TOS, config_parse_unsigned, 0, offsetof(VxLan, tos) VXLAN.TTL, config_parse_unsigned, 0, offsetof(VxLan, ttl) VXLAN.MacLearning, config_parse_bool, 0, offsetof(VxLan, learning) +VXLAN.ARPProxy, config_parse_bool, 0, offsetof(VxLan, arp_proxy) +VXLAN.L2Miss,config_parse_bool, 0, offsetof(VxLan, l2miss) +VXLAN.L3Miss,config_parse_bool, 0, offsetof(VxLan, l3miss) +VXLAN.RouteSC, config_parse_bool, 0, offsetof(VxLan, route_short_circuit) +VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) Tun.OneQueue,config_parse_bool, 0, offsetof(TunTap, one_queue) Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue) Tun.PacketInfo, config_parse_bool, 0, offsetof(TunTap, packet_info) diff --git
[systemd-devel] [PATCH] networkd: Support VXlan parameters
Add vxlan paramertes to config. --- man/systemd.netdev.xml | 30 + src/network/networkd-netdev-gperf.gperf | 7 ++- src/network/networkd-netdev-vxlan.c | 75 + src/network/networkd-netdev-vxlan.h | 8 src/network/networkd.h | 11 + 5 files changed, 130 insertions(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 275ee52..e25c1c4 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -272,6 +272,36 @@ to discover remote MAC addresses./para /listitem /varlistentry +varlistentry + termvarnameFDBAgeingSec=/varname/term +listitem +paraThe lifetime of FDB entries learnt by the kernel in seconds./para +/listitem +/varlistentry +varlistentry + termvarnameARPProxy=/varname/term +listitem +paraA boolean. When true, enables ARP proxy./para +/listitem +/varlistentry +varlistentry +termvarnameL2Miss=/varname/term +listitem +paraA boolean. When true, enables netlink LLADDR miss notifications./para +/listitem +/varlistentry +varlistentry +termvarnameL3Miss=/varname/term +listitem +paraA boolean. When true, enables netlink IP ADDR miss notifications./para +/listitem +/varlistentry +varlistentry + termvarnameRouteSC=/varname/term +listitem +paraA boolean. When true route short circuit is turned on./para +/listitem +/varlistentry /variablelist /refsect1 refsect1 diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index c524ee5..5ee5380 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -37,10 +37,15 @@ Tunnel.DiscoverPathMTU, config_parse_bool, 0, Peer.Name, config_parse_ifname,0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr,0, offsetof(Veth, mac_peer) VXLAN.Id,config_parse_uint64,0, offsetof(VxLan, id) -VXLAN.Group, config_parse_tunnel_address,0, offsetof(VxLan, group) +VXLAN.Group, config_parse_vxlan_group_address, 0, offsetof(VxLan, group) VXLAN.TOS, config_parse_unsigned, 0, offsetof(VxLan, tos) VXLAN.TTL, config_parse_unsigned, 0, offsetof(VxLan, ttl) VXLAN.MacLearning, config_parse_bool, 0, offsetof(VxLan, learning) +VXLAN.ARPProxy, config_parse_bool, 0, offsetof(VxLan, arp_proxy) +VXLAN.L2Miss,config_parse_bool, 0, offsetof(VxLan, l2miss) +VXLAN.L3Miss,config_parse_bool, 0, offsetof(VxLan, l3miss) +VXLAN.RouteSC, config_parse_bool, 0, offsetof(VxLan, route_short_circuit) +VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) Tun.OneQueue,config_parse_bool, 0, offsetof(TunTap, one_queue) Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue) Tun.PacketInfo, config_parse_bool, 0, offsetof(TunTap, packet_info) diff --git
Re: [systemd-devel] [PATCH] networkd: Support VXlan parameters
On 11/14/2014 01:48 PM, Ronny Chevalier wrote: 2014-11-14 8:44 GMT+01:00 Susant Sahani sus...@redhat.com: Hi, Hi, Add vxlan paramertes to config. --- +r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v-fdb_ageing / USEC_PER_MSEC); s/USEC_PER_MSEC/USEC_PER_SEC/ Good catch thanks ! fixed. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Support VXlan parameters
V3: fix copy paste error Add vxlan paramertes to config. --- man/systemd.netdev.xml | 30 src/network/networkd-netdev-gperf.gperf | 7 ++- src/network/networkd-netdev-vxlan.c | 81 + src/network/networkd-netdev-vxlan.h | 10 src/network/networkd.h | 11 + 5 files changed, 138 insertions(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 275ee52..e25c1c4 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -272,6 +272,36 @@ to discover remote MAC addresses./para /listitem /varlistentry +varlistentry + termvarnameFDBAgeingSec=/varname/term +listitem +paraThe lifetime of FDB entries learnt by the kernel in seconds./para +/listitem +/varlistentry +varlistentry + termvarnameARPProxy=/varname/term +listitem +paraA boolean. When true, enables ARP proxy./para +/listitem +/varlistentry +varlistentry +termvarnameL2Miss=/varname/term +listitem +paraA boolean. When true, enables netlink LLADDR miss notifications./para +/listitem +/varlistentry +varlistentry +termvarnameL3Miss=/varname/term +listitem +paraA boolean. When true, enables netlink IP ADDR miss notifications./para +/listitem +/varlistentry +varlistentry + termvarnameRouteSC=/varname/term +listitem +paraA boolean. When true route short circuit is turned on./para +/listitem +/varlistentry /variablelist /refsect1 refsect1 diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index c524ee5..5ee5380 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -37,10 +37,15 @@ Tunnel.DiscoverPathMTU, config_parse_bool, 0, Peer.Name, config_parse_ifname,0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr,0, offsetof(Veth, mac_peer) VXLAN.Id,config_parse_uint64,0, offsetof(VxLan, id) -VXLAN.Group, config_parse_tunnel_address,0, offsetof(VxLan, group) +VXLAN.Group, config_parse_vxlan_group_address, 0, offsetof(VxLan, group) VXLAN.TOS, config_parse_unsigned, 0, offsetof(VxLan, tos) VXLAN.TTL, config_parse_unsigned, 0, offsetof(VxLan, ttl) VXLAN.MacLearning, config_parse_bool, 0, offsetof(VxLan, learning) +VXLAN.ARPProxy, config_parse_bool, 0, offsetof(VxLan, arp_proxy) +VXLAN.L2Miss,config_parse_bool, 0, offsetof(VxLan, l2miss) +VXLAN.L3Miss,config_parse_bool, 0, offsetof(VxLan, l3miss) +VXLAN.RouteSC, config_parse_bool, 0, offsetof(VxLan, route_short_circuit) +VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) Tun.OneQueue,config_parse_bool, 0, offsetof(TunTap, one_queue) Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue) Tun.PacketInfo, config_parse_bool, 0, offsetof(TunTap, packet_info) diff
Re: [systemd-devel] [PATCH v2] localed: validate set-x11-keymap input
On 11/14/2014 05:12 PM, Jan Synacek wrote: +int xkb_validate_keymaps(const char *model, + const char *layouts_arg, + const char *variants_arg, + const char *options_arg, + char **error) +{ '{' should start next to ')' on the same line Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v2] localed: validate set-x11-keymap input
On 11/14/2014 05:12 PM, Jan Synacek wrote: +int xkb_keymap_get_components(X11Keymap *keymap) { +_cleanup_strv_free_ char **models = NULL, **options = NULL; +_cleanup_fclose_ FILE *f; +char line[LINE_MAX]; +enum KeymapComponent state = NONE; +size_t m = 0, o = 0, allocm = 0, alloco = 0; + +Hashmap *x11_layouts; +int r; + +x11_layouts = hashmap_new(string_hash_ops); +if (!x11_layouts) +return log_oom(); + +f = fopen(/usr/share/X11/xkb/rules/base.lst, re); +if (!f) { +log_error(Failed to open keyboard mapping list. %m); isn't x11_layouts leaking memory here ? should not we free this +return -errno; +} + +FOREACH_LINE(line, f, break) { +char *l, *w; +_cleanup_free_ char *layout = NULL; + +l = strstrip(line); + +if (isempty(l)) +continue; Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: support vxlan parameters
V3: fix copy paste error V4: Make manual and config more readable Add vxlan paramertes to config. --- man/systemd.netdev.xml | 30 src/network/networkd-netdev-gperf.gperf | 83 + src/network/networkd-netdev-vxlan.c | 81 src/network/networkd-netdev-vxlan.h | 10 src/network/networkd.h | 11 + 5 files changed, 176 insertions(+), 39 deletions(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 275ee52..45934f2 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -272,6 +272,36 @@ to discover remote MAC addresses./para /listitem /varlistentry +varlistentry + termvarnameFDBAgeingSec=/varname/term +listitem +paraThe lifetime of Forwarding Database entry learnt by the kernel in seconds./para +/listitem +/varlistentry +varlistentry + termvarnameARPProxy=/varname/term +listitem +paraA boolean. When true, enables ARP proxy./para +/listitem +/varlistentry +varlistentry + termvarnameL2MissNotification=/varname/term +listitem +paraA boolean. When true, enables netlink LLADDR miss notifications./para +/listitem +/varlistentry +varlistentry + termvarnameL3MissNotification=/varname/term +listitem +paraA boolean. When true, enables netlink IP ADDR miss notifications./para +/listitem +/varlistentry +varlistentry + termvarnameRouteShortCircuit=/varname/term +listitem +paraA boolean. When true route short circuit is turned on./para +/listitem +/varlistentry /variablelist /refsect1 refsect1 diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index c524ee5..b311ebe 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -18,42 +18,47 @@ struct ConfigPerfItem; %struct-type %includes %% -Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev, match_host) -Match.Virtualization,config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(NetDev, match_virt) -Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(NetDev, match_kernel) -Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE,offsetof(NetDev, match_arch) -NetDev.Description, config_parse_string,0, offsetof(NetDev, description) -NetDev.Name, config_parse_ifname,0, offsetof(NetDev, ifname) -NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind) -NetDev.MTUBytes, config_parse_iec_size, 0, offsetof(NetDev, mtu) -NetDev.MACAddress, config_parse_hwaddr,0, offsetof(NetDev, mac) -VLAN.Id, config_parse_uint64,0, offsetof(VLan, id) -MACVLAN.Mode,config_parse_macvlan_mode, 0, offsetof(MacVlan, mode) -Tunnel.Local,config_parse_tunnel_address,0, offsetof(Tunnel, local) -Tunnel.Remote, config_parse_tunnel_address,0, offsetof(Tunnel, remote) -Tunnel.TOS, config_parse_unsigned, 0, offsetof(Tunnel, tos) -Tunnel.TTL, config_parse_unsigned, 0, offsetof(Tunnel, ttl) -Tunnel.DiscoverPathMTU,
Re: [systemd-devel] [PATCH] networkd: Support VXlan parameters
On 11/15/2014 04:08 AM, Tom Gundersen wrote: Hi Susant, Hi Tom, Thanks for this! Thanks for the review . I have addressed all the comments. Only thing is since few names were long I had to indent the gperf file +VXLAN.L2MissNotification +VXLAN.L3MissNotification +VXLAN.RouteShortCircuit On Fri, Nov 14, 2014 at 10:33 AM, Susant Sahani sus...@redhat.com wrote: V3: fix copy paste error Add vxlan paramertes to config. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: Add bridge port path cost
This patch add support to specify path cost of the bridge port to be configured via conf file. Exampe: conf file: br.netdev [NetDev] Name=br-test Kind=bridge file: br.network [Match] Name=em1 [Network] Bridge=br-test [BridgePort] Cost=332 bridge link 2: em1 state UP : BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 master br-test state disabled priority 32 cost 332 --- man/systemd.network.xml | 13 + src/network/networkd-link.c | 93 src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c | 2 +- src/network/networkd.h | 2 + 5 files changed, 110 insertions(+), 1 deletion(-) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 4cc13b2..c9c946c 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -505,6 +505,19 @@ /refsect1 refsect1 +title[BridgePort] Section Options/title +paraThe literal[BridgePort]/literal section accepts the following keys./para +variablelist class='network-directives' +varlistentry +termvarnameCost=/varname/term +listitem + paraEach port in a bridge may have different speed. Cost is used to decide which link to use. Faster interfaces should have lower costs/para +/listitem +/varlistentry +/variablelist +/refsect1 + +refsect1 titleExample/title example title/etc/systemd/network/50-static.network/title diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 26ef0fe..dbc804b 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -705,6 +705,27 @@ int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) return 1; } +static int link_set_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { +_cleanup_link_unref_ Link *link = userdata; +int r; + +log_debug_link(link, set link); + +r = sd_rtnl_message_get_errno(m); +if (r 0 r != -EEXIST) { +log_struct_link(LOG_ERR, link, +MESSAGE=%-*s: could not join netdev: %s, +IFNAMSIZ, +link-ifname, strerror(-r), +ERRNO=%d, -r, +NULL); +link_enter_failed(link); +return 1; +} + +return 0; +} + static int set_hostname_handler(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { _cleanup_link_unref_ Link *link = userdata; @@ -826,6 +847,69 @@ int link_set_mtu(Link *link, uint32_t mtu) { return 0; } +static int link_set_bridge(Link *link) { +_cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL; +int r; + +assert(link); +assert(link-network); + +if(link-network-cost == 0) +return 0; + +r = sd_rtnl_message_new_link(link-manager-rtnl, req, + RTM_SETLINK, link-ifindex); +if (r 0) { +log_error_link(link, Could not allocate RTM_SETLINK message); +return r; +} + +r = sd_rtnl_message_link_set_family(req, PF_BRIDGE); +if (r 0) { +log_error_link(link, + Could not set message family %s, strerror(-r)); +return r; +} + +r = sd_rtnl_message_open_container(req, IFLA_PROTINFO); +if (r 0) { +log_error_link(link, + Could not append IFLA_PROTINFO attribute: %s, + strerror(-r)); +return r; +} + +if(link-network-cost != 0) { +r = sd_rtnl_message_append_u32(req, IFLA_BRPORT_COST, link-network-cost); +if (r 0) { +log_error_link(link, + Could not append IFLA_BRPORT_COST attribute: %s, + strerror(-r)); +return r; +} +} + +r = sd_rtnl_message_close_container(req); +if (r 0) { +log_error_link(link, + Could not append IFLA_LINKINFO attribute: %s, + strerror(-r)); +return r; +} + +r = sd_rtnl_call_async(link-manager-rtnl, req, link_set_handler, link, 0, NULL); +if (r 0) { +log_error_link(link, +
Re: [systemd-devel] [PATCH 1/2] namespace:Unchecked return value from library
On 11/17/2014 03:35 PM, David Herrmann wrote: Hi Hi, On Tue, Nov 11, 2014 at 11:33 AM, Susant Sahani sus...@redhat.com wrote: fix: CID 1237553 (#1 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#3 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#4 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#5 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#6 of 6): Unchecked return value from library (CHECKED_RETURN) @@ -289,7 +314,12 @@ static int mount_kdbus(BindMount *m) { } root = strappenda(temporary_mount, /kdbus); -mkdir(root, 0755); +r = mkdir(root, 0755); +if (r 0) { +r = -errno; +goto fail; +} + I also wonder whether we should check errno != EEXIST. Haven't looked at it in detail, yet. yes it's better. I'll modify it. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] namespace:Unchecked return value from library
fix: CID 1237553 (#1 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#3 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#4 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#5 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#6 of 6): Unchecked return value from library (CHECKED_RETURN) --- src/core/namespace.c | 48 ++-- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index eb7f2ad..db99e88 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -157,14 +157,26 @@ static int mount_dev(BindMount *m) { return -errno; dev = strappenda(temporary_mount, /dev); -mkdir(dev, 0755); + +r = mkdir(dev, 0755); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + if (mount(tmpfs, dev, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=755) 0) { r = -errno; goto fail; } devpts = strappenda(temporary_mount, /dev/pts); -mkdir(devpts, 0755); + +r = mkdir(devpts, 0755); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + if (mount(/dev/pts, devpts, NULL, MS_BIND, NULL) 0) { r = -errno; goto fail; @@ -174,7 +186,13 @@ static int mount_dev(BindMount *m) { symlink(pts/ptmx, devptmx); devshm = strappenda(temporary_mount, /dev/shm); -mkdir(devshm, 01777); + +r = mkdir(devshm, 01777); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + r = mount(/dev/shm, devshm, NULL, MS_BIND, NULL); if (r 0) { r = -errno; @@ -182,11 +200,23 @@ static int mount_dev(BindMount *m) { } devmqueue = strappenda(temporary_mount, /dev/mqueue); -mkdir(devmqueue, 0755); + +r = mkdir(devmqueue, 0755); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + mount(/dev/mqueue, devmqueue, NULL, MS_BIND, NULL); devhugepages = strappenda(temporary_mount, /dev/hugepages); -mkdir(devhugepages, 0755); + +r = mkdir(devhugepages, 0755); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + mount(/dev/hugepages, devhugepages, NULL, MS_BIND, NULL); devlog = strappenda(temporary_mount, /dev/log); @@ -282,7 +312,13 @@ static int mount_kdbus(BindMount *m) { } root = strappenda(temporary_mount, /kdbus); -mkdir(root, 0755); + +r = mkdir(root, 0755); +if (r 0 errno != EEXIST) { +r = -errno; +goto fail; +} + if (mount(tmpfs, root, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=777) 0) { r = -errno; goto fail; -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] namespace:Unchecked return value from library
fix: CID 1237553 (#1 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#3 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#4 of 6): Unchecked return value from library (CHECKED_RETURN) CID 1237553 (#5 of 6): Unchecked return value from library (CHECKED_RETURN CID 1237553 (#6 of 6): Unchecked return value from library (CHECKED_RETURN) --- src/core/namespace.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index eb7f2ad..a202545 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -157,14 +157,14 @@ static int mount_dev(BindMount *m) { return -errno; dev = strappenda(temporary_mount, /dev); -mkdir(dev, 0755); +(void)mkdir(dev, 0755); if (mount(tmpfs, dev, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=755) 0) { r = -errno; goto fail; } devpts = strappenda(temporary_mount, /dev/pts); -mkdir(devpts, 0755); +(void)mkdir(devpts, 0755); if (mount(/dev/pts, devpts, NULL, MS_BIND, NULL) 0) { r = -errno; goto fail; @@ -174,7 +174,7 @@ static int mount_dev(BindMount *m) { symlink(pts/ptmx, devptmx); devshm = strappenda(temporary_mount, /dev/shm); -mkdir(devshm, 01777); +(void)mkdir(devshm, 01777); r = mount(/dev/shm, devshm, NULL, MS_BIND, NULL); if (r 0) { r = -errno; @@ -182,11 +182,11 @@ static int mount_dev(BindMount *m) { } devmqueue = strappenda(temporary_mount, /dev/mqueue); -mkdir(devmqueue, 0755); +(void)mkdir(devmqueue, 0755); mount(/dev/mqueue, devmqueue, NULL, MS_BIND, NULL); devhugepages = strappenda(temporary_mount, /dev/hugepages); -mkdir(devhugepages, 0755); +(void)mkdir(devhugepages, 0755); mount(/dev/hugepages, devhugepages, NULL, MS_BIND, NULL); devlog = strappenda(temporary_mount, /dev/log); @@ -282,7 +282,7 @@ static int mount_kdbus(BindMount *m) { } root = strappenda(temporary_mount, /kdbus); -mkdir(root, 0755); +(void)mkdir(root, 0755); if (mount(tmpfs, root, tmpfs, MS_NOSUID|MS_STRICTATIME, mode=777) 0) { r = -errno; goto fail; -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
--- src/tty-ask-password-agent/tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..1fc792b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,8 +376,8 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +(void)mkfifo(p, 0600); fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (fd 0) return -errno; -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
On 11/17/2014 10:26 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 04:28:58PM +0530, Susant Sahani wrote: --- src/tty-ask-password-agent/tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..1fc792b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,8 +376,8 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +(void)mkfifo(p, 0600); You really aren't fixing anything in these patches, just merely papering over the Coverity issues. Which is fine, if you really want to do that, but don't think it's anything other than that... Yes my intention is to for coverity only Any way next line 'open' handling the error case . Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
On 11/17/2014 10:39 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 10:36:53PM +0530, Susant Sahani wrote: On 11/17/2014 10:26 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 04:28:58PM +0530, Susant Sahani wrote: --- src/tty-ask-password-agent/tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..1fc792b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,8 +376,8 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +(void)mkfifo(p, 0600); You really aren't fixing anything in these patches, just merely papering over the Coverity issues. Which is fine, if you really want to do that, but don't think it's anything other than that... Yes my intention is to for coverity only Any way next line 'open' handling the error case . I'm sorry, but I don't understand this sentance at all, can you rephrase it? Sorry let me rephrase it. This patch only for coverity . The next like of mkfifo is open . (void)mkfifo(p, 0600); fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (fd 0) return -errno; and open is handling the failure. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
On 11/17/2014 10:39 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 10:36:53PM +0530, Susant Sahani wrote: On 11/17/2014 10:26 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 04:28:58PM +0530, Susant Sahani wrote: --- src/tty-ask-password-agent/tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..1fc792b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,8 +376,8 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +(void)mkfifo(p, 0600); You really aren't fixing anything in these patches, just merely papering over the Coverity issues. Which is fine, if you really want to do that, but don't think it's anything other than that... Yes my intention is to for coverity only Any way next line 'open' handling the error case . I'm sorry, but I don't understand this sentance at all, can you rephrase it? Sorry let me rephrase it. This patch only for coverity . The next line of code mkfifo is open . (void)mkfifo(p, 0600); fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (fd 0) return -errno; and open is handling the failure. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] tty-ask-password-agent: fix CID 996261
On 11/18/2014 12:06 AM, Greg KH wrote: On Mon, Nov 17, 2014 at 06:47:33PM +0100, Ronny Chevalier wrote: 2014-11-17 18:31 GMT+01:00 Greg KH gre...@linuxfoundation.org: On Mon, Nov 17, 2014 at 10:44:14PM +0530, Susant Sahani wrote: On 11/17/2014 10:39 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 10:36:53PM +0530, Susant Sahani wrote: On 11/17/2014 10:26 PM, Greg KH wrote: On Mon, Nov 17, 2014 at 04:28:58PM +0530, Susant Sahani wrote: --- src/tty-ask-password-agent/tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index e6dc84b..1fc792b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -376,8 +376,8 @@ static int wall_tty_block(void) { return -ENOMEM; mkdir_parents_label(p, 0700); -mkfifo(p, 0600); +(void)mkfifo(p, 0600); You really aren't fixing anything in these patches, just merely papering over the Coverity issues. Which is fine, if you really want to do that, but don't think it's anything other than that... Yes my intention is to for coverity only Any way next line 'open' handling the error case . I'm sorry, but I don't understand this sentance at all, can you rephrase it? Sorry let me rephrase it. This patch only for coverity . The next like of mkfifo is open . (void)mkfifo(p, 0600); fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (fd 0) return -errno; and open is handling the failure. Then coverity should be fixed, don't paper over stupid bugs in tools for no reason. I disagree. Coverity can not infer this in any possible way. How can coverity infer that we do not care about the return value of mkfifo ? It really depends of the semantic here. Coverity is a semantic checker, why can't it be changed to determine if mkfifo() is followed by open() and an error check, that it is safe code? It does this for lots of other common patterns. For now mkfifo/mkdir/ioctl coverity is not that smart or is it ? From the behaviour of coverity It looks for single statement in these scenario . The mkfifo could be one function then this fifo can be used some other function like open or read/write. There are several scenario would be like this . Susant ___ 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,
[systemd-devel] [PATCH 1/2] networkd: Introduce Link Layer Discovery Protocol (LLDP)
This patch introduces LLDP support to networkd. it implements the receiver side of the protocol. The Link Layer Discovery Protocol (LLDP) is an industry-standard, vendor-neutral method to allow networked devices to advertise capabilities, identity, and other information onto a LAN. The Layer 2 protocol, detailed in IEEE 802.1AB-2005.LLDP allows network devices that operate at the lower layers of a protocol stack (such as Layer 2 bridges and switches) to learn some of the capabilities and characteristics of LAN devices available to higher layer protocols. --- Makefile.am| 27 +- src/libsystemd-network/lldp-internal.c | 421 src/libsystemd-network/lldp-internal.h | 94 +++ src/libsystemd-network/lldp-network.c | 111 src/libsystemd-network/lldp-network.h | 28 ++ src/libsystemd-network/lldp-port.c | 116 src/libsystemd-network/lldp-port.h | 61 src/libsystemd-network/lldp-tlv.c | 319 + src/libsystemd-network/lldp-tlv.h | 87 ++ src/libsystemd-network/lldp.h | 115 src/libsystemd-network/sd-lldp.c | 495 + src/libsystemd-network/sd-lldp.h | 51 src/libsystemd-network/test-lldp.c | 233 13 files changed, 2156 insertions(+), 2 deletions(-) create mode 100644 src/libsystemd-network/lldp-internal.c create mode 100644 src/libsystemd-network/lldp-internal.h create mode 100644 src/libsystemd-network/lldp-network.c create mode 100644 src/libsystemd-network/lldp-network.h create mode 100644 src/libsystemd-network/lldp-port.c create mode 100644 src/libsystemd-network/lldp-port.h create mode 100644 src/libsystemd-network/lldp-tlv.c create mode 100644 src/libsystemd-network/lldp-tlv.h create mode 100644 src/libsystemd-network/lldp.h create mode 100644 src/libsystemd-network/sd-lldp.c create mode 100644 src/libsystemd-network/sd-lldp.h create mode 100644 src/libsystemd-network/test-lldp.c diff --git a/Makefile.am b/Makefile.am index 3f9f3fa..dc18a6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2948,7 +2948,18 @@ libsystemd_network_la_SOURCES = \ src/libsystemd-network/dhcp6-network.c \ src/libsystemd-network/dhcp6-option.c \ src/libsystemd-network/dhcp6-lease-internal.h \ - src/libsystemd-network/sd-dhcp6-lease.c + src/libsystemd-network/sd-dhcp6-lease.c \ + src/libsystemd-network/lldp.h \ + src/libsystemd-network/lldp-tlv.h \ + src/libsystemd-network/lldp-tlv.c \ + src/libsystemd-network/lldp-network.h \ + src/libsystemd-network/lldp-network.c \ + src/libsystemd-network/lldp-port.h \ + src/libsystemd-network/lldp-port.c \ + src/libsystemd-network/lldp-internal.h \ + src/libsystemd-network/lldp-internal.c \ + src/libsystemd-network/sd-lldp.h \ + src/libsystemd-network/sd-lldp.c libsystemd_network_la_LIBADD = \ libudev-internal.la \ @@ -3027,13 +3038,25 @@ test_dhcp6_client_LDADD = \ libsystemd-internal.la \ libsystemd-shared.la +test_lldp_SOURCES = \ + src/libsystemd-network/lldp.h \ + src/libsystemd-network/lldp-tlv.h \ + src/libsystemd-network/lldp-tlv.c \ + src/libsystemd-network/test-lldp.c + +test_lldp_LDADD = \ + libsystemd-network.la \ + libsystemd-internal.la \ + libsystemd-shared.la + tests += \ test-dhcp-option \ test-dhcp-client \ test-dhcp-server \ test-ipv4ll \ test-icmp6-rs \ - test-dhcp6-client + test-dhcp6-client \ + test-lldp manual_tests += \ test-pppoe diff --git a/src/libsystemd-network/lldp-internal.c b/src/libsystemd-network/lldp-internal.c new file mode 100644 index 000..1db7919 --- /dev/null +++ b/src/libsystemd-network/lldp-internal.c @@ -0,0 +1,421 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright (C) 2014 Tom Gundersen + Copyright (C) 2014 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include lldp-internal.h + +/* We store maximum 1K chassis entries */ +#define LLDP_MIB_MAX_CHASSIS 1024 + +/* Maximum Ports can be attached to any chassis */ +#define LLDP_MIB_MAX_PORT_PER_CHASSIS 32 + +int lldp_read_chassis_id(tlv_packet *tlv
Re: [systemd-devel] [PATCH 1/2] networkd: Introduce Link Layer Discovery Protocol (LLDP)
Hi Tom, On Sat, 20 Dec 2014 04:40:17 +0530, Tom Gundersen t...@jklm.no wrote: I have now mergede these patches, with some minor cleanups on top. Susant, please yell if I broke something when fixing the headers. Tested and works fine. thanks ! Cheers, Tom On Sun, Nov 23, 2014 at 5:45 AM, Susant Sahani sus...@redhat.com wrote: This patch introduces LLDP support to networkd. it implements the receiver side of the protocol. The Link Layer Discovery Protocol (LLDP) is an industry-standard, vendor-neutral method to allow networked devices to advertise capabilities, identity, and other information onto a LAN. The Layer 2 protocol, detailed in IEEE 802.1AB-2005.LLDP allows network devices that operate at the lower layers of a protocol stack (such as Layer 2 bridges and switches) to learn some of the capabilities and characteristics of LAN devices available to higher layer protocols. --- -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] fix spell
--- man/sd_event_add_child.xml | 2 +- man/sd_event_add_signal.xml | 2 +- man/systemctl.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/sd_event_add_child.xml b/man/sd_event_add_child.xml index 9d943f8..7a84fce 100644 --- a/man/sd_event_add_child.xml +++ b/man/sd_event_add_child.xml @@ -100,7 +100,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. being stopped by a signal), and constantWCONTINUED/constant (watch for the child being resumed by a signal). See citerefentryrefentrytitlewaitid/refentrytitlemanvolnum2/manvolnum/citerefentry -for futher information./para +for further information./para paraOnly a single handler may be installed for a specific child. The handler is enabled diff --git a/man/sd_event_add_signal.xml b/man/sd_event_add_signal.xml index f39751d..0299aa5 100644 --- a/man/sd_event_add_signal.xml +++ b/man/sd_event_add_signal.xml @@ -95,7 +95,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. structnameconst struct signalfd_siginfo/structname containing the information about the received signal. See citerefentryrefentrytitlesignalfd/refentrytitlemanvolnum2/manvolnum/citerefentry -for futher information./para +for further information./para paraOnly a single handler may be installed for a specific signal. The signal will be unblocked, and must be diff --git a/man/systemctl.xml b/man/systemctl.xml index d1991e0..3ac6f62 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -173,7 +173,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. paraNote that any varnameAfter=/varname dependency is automatically mirrored to create a varnameBefore=/varname dependency. Temporal dependencies - may be specified explictly, but are also created implicitly + may be specified explicitly, but are also created implicitly for units which are varnameWantedBy=/varname targets (see citerefentryrefentrytitlesystemd.target/refentrytitlemanvolnum5/manvolnum/citerefentry), -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] man: Fix spelling
--- man/sd_event_add_child.xml | 2 +- man/sd_event_add_signal.xml | 2 +- man/systemctl.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/sd_event_add_child.xml b/man/sd_event_add_child.xml index 9d943f8..7a84fce 100644 --- a/man/sd_event_add_child.xml +++ b/man/sd_event_add_child.xml @@ -100,7 +100,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. being stopped by a signal), and constantWCONTINUED/constant (watch for the child being resumed by a signal). See citerefentryrefentrytitlewaitid/refentrytitlemanvolnum2/manvolnum/citerefentry -for futher information./para +for further information./para paraOnly a single handler may be installed for a specific child. The handler is enabled diff --git a/man/sd_event_add_signal.xml b/man/sd_event_add_signal.xml index f39751d..0299aa5 100644 --- a/man/sd_event_add_signal.xml +++ b/man/sd_event_add_signal.xml @@ -95,7 +95,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. structnameconst struct signalfd_siginfo/structname containing the information about the received signal. See citerefentryrefentrytitlesignalfd/refentrytitlemanvolnum2/manvolnum/citerefentry -for futher information./para +for further information./para paraOnly a single handler may be installed for a specific signal. The signal will be unblocked, and must be diff --git a/man/systemctl.xml b/man/systemctl.xml index d1991e0..3ac6f62 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -173,7 +173,7 @@ along with systemd; If not, see http://www.gnu.org/licenses/. paraNote that any varnameAfter=/varname dependency is automatically mirrored to create a varnameBefore=/varname dependency. Temporal dependencies - may be specified explictly, but are also created implicitly + may be specified explicitly, but are also created implicitly for units which are varnameWantedBy=/varname targets (see citerefentryrefentrytitlesystemd.target/refentrytitlemanvolnum5/manvolnum/citerefentry), -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] fix spell
On Tue, 30 Dec 2014 21:12:51 +0530, Paul Menzel paulepan...@users.sourceforge.net wrote: man: Fix spelling Sure Thanks ! -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] man: Fix spelling
On Wed, 31 Dec 2014 02:35:00 +0530, Martin Pitt martin.p...@ubuntu.com wrote: Hey Susant, Hi Martin, Applied, thanks! Thanks ! Martin -- Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] LLDP: Support locally assigned port subtype
The Zyxel switch sends port subtype as Locally assigned (7). Add LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED as supported type reported by Mantas Mikulėnas graw...@gmail.com --- src/libsystemd-network/lldp-internal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libsystemd-network/lldp-internal.c b/src/libsystemd-network/lldp-internal.c index f843fd2..c6a989a 100644 --- a/src/libsystemd-network/lldp-internal.c +++ b/src/libsystemd-network/lldp-internal.c @@ -89,6 +89,7 @@ int lldp_read_port_id(tlv_packet *tlv, case LLDP_PORT_SUBTYPE_PORT_COMPONENT: case LLDP_PORT_SUBTYPE_INTERFACE_ALIAS: case LLDP_PORT_SUBTYPE_INTERFACE_NAME: +case LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED: r = tlv_packet_read_string(tlv, s, length); if (r 0) -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] journald: Introduce RFC 5424 syslog
) +server_forward_syslog_network(s-server, syslog_fixup_facility(priority), s-identifier, p, s-ucred, NULL); + if (s-forward_to_kmsg || s-server-forward_to_kmsg) server_forward_kmsg(s-server, priority, s-identifier, p, s-ucred); diff --git a/src/journal/journald-syslog-network.c b/src/journal/journald-syslog-network.c new file mode 100644 index 000..0f7b494 --- /dev/null +++ b/src/journal/journald-syslog-network.c @@ -0,0 +1,246 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2015 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +***/ + +#include unistd.h +#include stddef.h +#include poll.h + +#include shared/in-addr-util.h +#include journald-server.h +#include journald-syslog.h +#include systemd/sd-messages.h + +/* Warn once every 30s if we missed syslog message */ +#define WARN_FORWARD_SYSLOG_MISSED_ID syslog-network-missed + +#define RFC_5424_NILVALUE - +#define RFC_5424_PROTOCOL 1 + +static void server_maybe_warn_forward_syslog_network_missed(Server *s, int priority) { +int r; + +assert(s); + +if (s-n_forward_syslog_network_missed = 0) +return; + +r = journal_rate_limit_test(s-syslog_network_rate_limit, WARN_FORWARD_SYSLOG_MISSED_ID, +priority LOG_PRIMASK, available_space(s, false)); +if (r == 0) +return; + +server_driver_message(s, SD_MESSAGE_FORWARD_SYSLOG_MISSED, + Forwarding to syslog network missed %u messages., + s-n_forward_syslog_network_missed); + +s-n_forward_syslog_network_missed = 0; +} + +static int syslog_network_send(Server *s, struct iovec *iovec, unsigned n_iovec, int priority) { +struct msghdr mh = { }; + +assert(s); +assert(iovec); +assert(n_iovec 0); + +mh.msg_iov = iovec; +mh.msg_iovlen = n_iovec; + +if (s-syslog_addr.sockaddr.sa.sa_family == AF_INET) { +mh.msg_name = s-syslog_addr.sockaddr.sa; +mh.msg_namelen = sizeof(s-syslog_addr.sockaddr.sa); +} else if (s-syslog_addr.sockaddr.sa.sa_family == AF_INET6) { +mh.msg_name = s-syslog_addr.sockaddr.in6; +mh.msg_namelen = sizeof(s-syslog_addr.sockaddr.in6); +} else +return -EAFNOSUPPORT; + +if (sendmsg(s-syslog_network_fd, mh, MSG_NOSIGNAL) = 0) +return 0; + +s-n_forward_syslog_network_missed++; + +server_maybe_warn_forward_syslog_network_missed(s, priority); + +return 0; +} + +/* RFC3339 timestamp format: -MM-DDTHH:MM:SS[.frac]+/-ZZ:ZZ */ +void format_rfc3339_timestamp(const struct timeval *tv, char *header_time, size_t header_size) { +char gm_buf[sizeof(+0530) + 1]; +struct tm tm; +time_t t; + +t = tv ? tv-tv_sec : ((time_t) (now(CLOCK_REALTIME) / USEC_PER_SEC)); +localtime_r(t, tm); + +strftime(header_time, header_size, %Y-%m-%dT%T, tm); + +/* add fractional part */ +if (tv) +snprintf(header_time + strlen(header_time), header_size, .%06ld, tv-tv_usec); + +/* format the timezone according to RFC */ +xstrftime(gm_buf, %z, tm); +snprintf(header_time + strlen(header_time), header_size, %.3s:%.2s , gm_buf, gm_buf + 3); +} + +/* The Syslog Protocol RFC5424 format : + * PRIVERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP [SD-ID]s SP MSG + */ +void server_forward_syslog_network(Server *s, + int priority, + const char *identifier, + const char *message, + const struct ucred *ucred, + const struct timeval *tv) { +char header_pid[DECIMAL_STR_MAX(pid_t) + 1]; +char header_priority[sizeof( 1 ) + 1]; +char header_time[FORMAT_TIMESTAMP_MAX]; +struct iovec iov[13]; +int n = 0; + +assert(s); +assert(priority = 0); +assert(priority = 999); +assert(message); + +if (LOG_PRI(priority) s-max_level_syslog) +return; + +/* First: priority field Second: Version 'priversion
Re: [systemd-devel] [PATCH] journald: Introduce RFC 5424 syslog
On Thu, 19 Feb 2015 13:53:42 +0530, Umut Tezduyar Lindskog u...@tezduyar.com wrote: Hi Susant, Hi Umut, Thanks for reviewing. On Thu, Feb 19, 2015 at 8:58 AM, Susant Sahani sus...@redhat.com wrote: This patch adds support for RFC 5424 syslog format to journald. Journald can now forward logs to a multicast UDP group. RFC 5424 format: PRIVERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP [SD-ID]s SP MSG Example conf: file: journald.conf SysLogAddress=239.0.0.1:6000 --- Makefile.am | 1 + man/journald.conf.xml | 12 ++ src/journal/journald-gperf.gperf | 1 + src/journal/journald-native.c | 3 + src/journal/journald-server.c | 40 +- src/journal/journald-server.h | 14 ++ src/journal/journald-stream.c | 4 + src/journal/journald-syslog-network.c | 246 ++ src/journal/journald-syslog.c | 3 + src/journal/journald-syslog.h | 2 + 10 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 src/journal/journald-syslog-network.c diff --git a/Makefile.am b/Makefile.am index ba63f68..b015f69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4487,6 +4487,7 @@ libsystemd_journal_core_la_SOURCES = \ src/journal/journald-kmsg.h \ src/journal/journald-syslog.c \ src/journal/journald-syslog.h \ + src/journal/journald-syslog-network.c \ src/journal/journald-stream.c \ src/journal/journald-stream.h \ src/journal/journald-server.c \ diff --git a/man/journald.conf.xml b/man/journald.conf.xml index 364b58f..4fb037b 100644 --- a/man/journald.conf.xml +++ b/man/journald.conf.xml @@ -355,6 +355,18 @@ /varlistentry varlistentry +termvarnameSysLogAddress=/varname/term +listitemparaControls whether log messages received by the +journal daemon shall be forwarded to a multicast UDP network +group in syslog RFC 5424 format./para + +paraThe the address string format is similar to socket units. See Double the. + citerefentryrefentrytitlesystemd.socket/refentrytitlemanvolnum1/manvolnum/citerefentry +/para +/listitem + /varlistentry + + varlistentry termvarnameTTYPath=/varname/term listitemparaChange the console TTY to use if diff --git a/src/journal/journald-gperf.gperf b/src/journal/journald-gperf.gperf index 74554c1..9cdffbc 100644 --- a/src/journal/journald-gperf.gperf +++ b/src/journal/journald-gperf.gperf @@ -40,3 +40,4 @@ Journal.MaxLevelKMsg, config_parse_log_level, 0, offsetof(Server, max_lev Journal.MaxLevelConsole,config_parse_log_level, 0, offsetof(Server, max_level_console) Journal.MaxLevelWall, config_parse_log_level, 0, offsetof(Server, max_level_wall) Journal.SplitMode, config_parse_split_mode, 0, offsetof(Server, split_mode) +Journal.SysLogAddress, config_parse_syslog_network_address, 0, offsetof(Server, syslog_addr) diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 851625d..9fd370f 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -273,6 +273,9 @@ void server_process_native_message( if (s-forward_to_syslog) server_forward_syslog(s, priority, identifier, message, ucred, tv); +if (s-forward_to_network) +server_forward_syslog_network(s, priority, identifier, message, ucred, tv); + if (s-forward_to_kmsg) server_forward_kmsg(s, priority, identifier, message, ucred); diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 7ee8174..de4ef50 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -86,7 +86,7 @@ static const char* const split_mode_table[_SPLIT_MAX] = { DEFINE_STRING_TABLE_LOOKUP(split_mode, SplitMode); DEFINE_CONFIG_PARSE_ENUM(config_parse_split_mode, split_mode, SplitMode, Failed to parse split mode setting); -static uint64_t available_space(Server *s, bool verbose) { +uint64_t available_space(Server *s, bool verbose) { char ids[33]; _cleanup_free_ char *p = NULL; sd_id128_t machine; @@ -1356,6 +1356,35 @@ static int server_parse_config_file(Server *s) { false, s); } +int config_parse_syslog_network_address(const char *unit, +const char *filename, +unsigned line, +const char *section, +unsigned section_line, +const char *lvalue, +int ltype, +const char *rvalue, +void *data
Re: [systemd-devel] [PATCH] journald: Introduce RFC 5424 syslog
Hi Lennart, On Thu, 19 Feb 2015 16:40:04 +0530, Lennart Poettering lenn...@poettering.net wrote: On Thu, 19.02.15 13:28, Susant Sahani (sus...@redhat.com) wrote: This patch adds support for RFC 5424 syslog format to journald. Journald can now forward logs to a multicast UDP group. RFC 5424 format: PRIVERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP [SD-ID]s SP MSG Hmm, wasn't the last proposal we discussed to do this in an auxiliary daemmon, possibly in systemd-journal-upload or so, but not in journald? ohhh. I missed that part. I see two problems with journald: first of all, for security reasons I am conservative about making it deal with the network directly. Opening up such a basic daemon to the network is a something i'd prefer to avoid. The other thing is that journald runs really really early during boot, at a time where the network is unlikely to be up. This means that early boot msgs could never be delivered via syslog... Makes sense . I agree with it. I'd really prefer a scheme where this syslog broadcaster can be run relatively late at boot and where it tries to repeatedly send the messages, until sendmsg() actually succeeds. i.e. using the journal cursor logic it would not send a log message until the point where the previous message was delivered with a successful sendmsg(). Wth such a scheme all early boot msgs would be dumped on the network the moment the network is up. So do we want to write down another daemon or integrate with journad with cursor logic ? I am ok with any of this. Zbigniew, do you have more ideas about this? Lennart Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] LLDP from Zyxel – Operation not supported
On Mon, 12 Jan 2015 13:23:40 +0530, Mantas Mikulėnas graw...@gmail.com wrote: I enabled LLDP receive for eth* in networkd. It recognizes outgoing packets sent by lldpd (on the computer itself) and by ladvd (on pfSense), but chokes on incoming packets sent by a Zyxel switch: LLDP: Receive frame failed: Operation not supported The Zyxel switch sending port subtype as Port Id Subtype: Locally assigned (7). Currently supported port id are LLDP_PORT_SUBTYPE_PORT_COMPONENT: LLDP_PORT_SUBTYPE_INTERFACE_ALIAS: LLDP_PORT_SUBTYPE_INTERFACE_NAME: LLDP_PORT_SUBTYPE_MAC_ADDRESS: We need to add the LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED = 7. Attaching the actual packet. (By the way, `networkctl lldp` is a bit boring – it'd be more useful to show the SysName instead of the TTL...) Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] journal: Introduce journal-network
Hi Zbigniew, Thanks for the review. On 03/16/2015 07:47 AM, Zbigniew Jędrzejewski-Szmek wrote: On Fri, Mar 13, 2015 at 10:55:42PM +0530, Susant Sahani wrote: This tiny daemon enables to pull journal entries and push to a UDP multicast address in syslog RFC 5424 format. journal-syslog-network runs with own user systemd-journal-push. It starts running after the network is up. Looks very nice. It indeed seems right to do this as a separate daemon. Some comments below. Thanks . --- Makefile-man.am| 8 + Makefile.am| 40 ++ man/systemd-journal-network.service.xml| 84 + man/systemd-journal-network.xml| 115 ++ src/journal-remote/journal-network-conf.c | 61 src/journal-remote/journal-network-conf.h | 32 ++ src/journal-remote/journal-network-gperf.gperf | 18 + src/journal-remote/journal-network-manager.c | 481 + src/journal-remote/journal-network-manager.h | 70 src/journal-remote/journal-network-proto.c | 218 +++ src/journal-remote/journal-network.c | 218 +++ src/journal-remote/journal-network.conf.in | 2 + units/systemd-journal-network.service.in | 19 + 13 files changed, 1366 insertions(+) create mode 100644 man/systemd-journal-network.service.xml create mode 100644 man/systemd-journal-network.xml create mode 100644 src/journal-remote/journal-network-conf.c create mode 100644 src/journal-remote/journal-network-conf.h create mode 100644 src/journal-remote/journal-network-gperf.gperf create mode 100644 src/journal-remote/journal-network-manager.c create mode 100644 src/journal-remote/journal-network-manager.h create mode 100644 src/journal-remote/journal-network-proto.c create mode 100644 src/journal-remote/journal-network.c create mode 100644 src/journal-remote/journal-network.conf.in create mode 100644 units/systemd-journal-network.service.in diff --git a/Makefile-man.am b/Makefile-man.am index 7a9612e..efd0cbc 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -1357,6 +1357,14 @@ man/systemd-journal-gatewayd.socket.html: man/systemd-journal-gatewayd.service.h endif +MANPAGES += \ +man/systemd-journal-network.service.8 \ +man/systemd-journal-network.8 +MANPAGES_ALIAS += \ +man/systemd-journal-network.8 +man/systemd-journal-network.8: man/systemd-journal-network.service.8 +man/systemd-journal-network.html: man/systemd-journal-network.service.html + if HAVE_MYHOSTNAME MANPAGES += \ man/nss-myhostname.8 diff --git a/Makefile.am b/Makefile.am index 856accb..ad1dff5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4336,6 +4336,46 @@ EXTRA_DIST += \ src/journal-remote/journal-upload.conf.in endif +rootlibexec_PROGRAMS += \ + systemd-journal-network I think this name will be confusing. Why not systemd-journal-syslog or systemd-journal-multicast? Network is rather generic, and we already have three other network-and-journal-related daemons. Yes I was confused with the naming. Indeed I named it as systemd-journal-syslog once too. Later I was wondering naming it to syslog only make it restricted. If in future enhancements we decide to add more features like sending in a different format . + +systemd_journal_network_SOURCES = \ + src/journal-remote/journal-network-manager.h \ + src/journal-remote/journal-network-manager.c \ + src/journal-remote/journal-network-conf.h \ + src/journal-remote/journal-network-conf.c \ + src/journal-remote/journal-network-proto.c \ + src/journal-remote/journal-network.c + +nodist_systemd_journal_network_SOURCES = \ + src/journal-remote/journal-network-gperf.c + +EXTRA_DIST += \ +src/journal-remote/journal-network-gperf.gperf + +CLEANFILES += \ +src/journal-remote/journal-network-gperf.c + +systemd_journal_network_LDADD = \ + libsystemd-internal.la \ + libsystemd-journal-internal.la \ + libsystemd-shared.la + +nodist_systemunit_DATA += \ + units/systemd-journal-network.service + +EXTRA_DIST += \ + units/systemd-journal-network.service.in + +nodist_pkgsysconf_DATA += \ + src/journal-remote/journal-network.conf + +EXTRA_DIST += \ + src/journal-remote/journal-network.conf.in + +CLEANFILES += \ + src/journal-remote/journal-network.conf You can drop that, CLEANFILES in now generated semi-automatically in git. Ok. # using _CFLAGS = in the conditional below would suppress AM_CFLAGS journalctl_CFLAGS = \ $(AM_CFLAGS) diff --git a/man/systemd-journal-network.service.xml b/man/systemd-journal-network.service.xml new file mode 100644 index 000..47a5b3e --- /dev/null +++ b/man/systemd-journal-network.service.xml @@ -0,0 +1,84 @@ +?xml version='1.0'? !--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-- +!DOCTYPE refentry PUBLIC
[systemd-devel] [PATCH] journal: Introduce journal-network
This tiny daemon enables to pull journal entries and push to a UDP multicast address in syslog RFC 5424 format. journal-syslog-network runs with own user systemd-journal-push. It starts running after the network is up. --- Makefile-man.am| 8 + Makefile.am| 40 ++ man/systemd-journal-network.service.xml| 84 + man/systemd-journal-network.xml| 115 ++ src/journal-remote/journal-network-conf.c | 61 src/journal-remote/journal-network-conf.h | 32 ++ src/journal-remote/journal-network-gperf.gperf | 18 + src/journal-remote/journal-network-manager.c | 481 + src/journal-remote/journal-network-manager.h | 70 src/journal-remote/journal-network-proto.c | 218 +++ src/journal-remote/journal-network.c | 218 +++ src/journal-remote/journal-network.conf.in | 2 + units/systemd-journal-network.service.in | 19 + 13 files changed, 1366 insertions(+) create mode 100644 man/systemd-journal-network.service.xml create mode 100644 man/systemd-journal-network.xml create mode 100644 src/journal-remote/journal-network-conf.c create mode 100644 src/journal-remote/journal-network-conf.h create mode 100644 src/journal-remote/journal-network-gperf.gperf create mode 100644 src/journal-remote/journal-network-manager.c create mode 100644 src/journal-remote/journal-network-manager.h create mode 100644 src/journal-remote/journal-network-proto.c create mode 100644 src/journal-remote/journal-network.c create mode 100644 src/journal-remote/journal-network.conf.in create mode 100644 units/systemd-journal-network.service.in diff --git a/Makefile-man.am b/Makefile-man.am index 7a9612e..efd0cbc 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -1357,6 +1357,14 @@ man/systemd-journal-gatewayd.socket.html: man/systemd-journal-gatewayd.service.h endif +MANPAGES += \ +man/systemd-journal-network.service.8 \ +man/systemd-journal-network.8 +MANPAGES_ALIAS += \ +man/systemd-journal-network.8 +man/systemd-journal-network.8: man/systemd-journal-network.service.8 +man/systemd-journal-network.html: man/systemd-journal-network.service.html + if HAVE_MYHOSTNAME MANPAGES += \ man/nss-myhostname.8 diff --git a/Makefile.am b/Makefile.am index 856accb..ad1dff5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4336,6 +4336,46 @@ EXTRA_DIST += \ src/journal-remote/journal-upload.conf.in endif +rootlibexec_PROGRAMS += \ + systemd-journal-network + +systemd_journal_network_SOURCES = \ + src/journal-remote/journal-network-manager.h \ + src/journal-remote/journal-network-manager.c \ + src/journal-remote/journal-network-conf.h \ + src/journal-remote/journal-network-conf.c \ + src/journal-remote/journal-network-proto.c \ + src/journal-remote/journal-network.c + +nodist_systemd_journal_network_SOURCES = \ + src/journal-remote/journal-network-gperf.c + +EXTRA_DIST += \ +src/journal-remote/journal-network-gperf.gperf + +CLEANFILES += \ +src/journal-remote/journal-network-gperf.c + +systemd_journal_network_LDADD = \ + libsystemd-internal.la \ + libsystemd-journal-internal.la \ + libsystemd-shared.la + +nodist_systemunit_DATA += \ + units/systemd-journal-network.service + +EXTRA_DIST += \ + units/systemd-journal-network.service.in + +nodist_pkgsysconf_DATA += \ + src/journal-remote/journal-network.conf + +EXTRA_DIST += \ + src/journal-remote/journal-network.conf.in + +CLEANFILES += \ + src/journal-remote/journal-network.conf + # using _CFLAGS = in the conditional below would suppress AM_CFLAGS journalctl_CFLAGS = \ $(AM_CFLAGS) diff --git a/man/systemd-journal-network.service.xml b/man/systemd-journal-network.service.xml new file mode 100644 index 000..47a5b3e --- /dev/null +++ b/man/systemd-journal-network.service.xml @@ -0,0 +1,84 @@ +?xml version='1.0'? !--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN +http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; + +!-- +This file is part of systemd. + +Copyright 2015 Susant Sahani + +systemd is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +systemd is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with systemd; If not, see http://www.gnu.org/licenses/. +-- + +refentry id=systemd-journal-network.service
[systemd-devel] [PATCH] networkd: Add support for bond option.
This patch adds configurational support for bond option. Test conf: bond.netdev --- [NetDev] Name=bond1 Kind=bond [Bond] ArpAllTargets=all PrimaryReselect=better ArpIntervalSec=10s ArpIpTargets= 192.168.8.102 192.168.8.101 192.168.8.102 --- $cat /proc/net/bonding/bond1 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 0 Up Delay (ms): 0 Down Delay (ms): 0 ARP Polling Interval (ms): 1 ARP IP target/s (n.n.n.n form): 192.168.8.100, 192.168.8.101, 192.168.8.102 --- man/systemd.netdev.xml | 167 + src/libsystemd/sd-rtnl/rtnl-types.c | 26 ++- src/libsystemd/sd-rtnl/rtnl-types.h | 22 +++ src/network/networkd-netdev-bond.c | 318 +++- src/network/networkd-netdev-bond.h | 85 - src/network/networkd-netdev-gperf.gperf | 13 ++ 6 files changed, 627 insertions(+), 4 deletions(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index ef58887..4230d19 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -647,7 +647,174 @@ /listitem /varlistentry + varlistentry +termvarnameLearnPacketIntvSec,=/varname/term +listitem + paraSpecifies the number of seconds between instances where the bonding + driver sends learning packets to each slaves peer switch. + The valid range is 1 - 0x7fff; the default value is 1. This Option + has effect only in balance-tlb and balance-alb modes./para +/listitem + /varlistentry + + varlistentry +termvarnameAdSelect=/varname/term +listitem + paraSpecifies the 802.3ad aggregation selection logic to use. Possible values are + literalstable/literal, + literalbandwidth/literal, + literalcount/literal + /para +/listitem + /varlistentry + + varlistentry +termvarnameFailOverMac=/varname/term +listitem + paraSpecifies whether active-backup mode should set all slaves to + the same MAC address at enslavement or, when enabled, perform special handling of the + bond's MAC address in accordance with the selected policy. The default policy is none. + Possible values are + literalnone/literal, + literalactive/literal, + literalfollow/literal + /para +/listitem + /varlistentry + + varlistentry +termvarnameArpValidate=/varname/term +listitem + paraSpecifies whether or not ARP probes and replies should be + validated in any mode that supports arp monitoring, or whether + non-ARP traffic should be filtered (disregarded) for link + monitoring purposes. Possible values are + literalnone/literal, + literalactive/literal, + literalbackup/literal, + literalall/literal + /para +/listitem + /varlistentry + + varlistentry +termvarnameArpIntervalSec=/varname/term +listitem + paraSpecifies the ARP link monitoring frequency in milliseconds. + A value of 0 disables ARP monitoring. The default value is 0. + /para +/listitem + /varlistentry + + varlistentry +termvarnameArpIpTargets=/varname/term +listitem + paraSpecifies the IP addresses to use as ARP monitoring peers when + ArpIntervalSec is greater than 0. These are the targets of the ARP request + sent to determine the health of the link to the targets. + Specify these values in ipv4 dotted decimal format. At least one IP + address must be given for ARP monitoring to function. The + maximum number of targets that can be specified is 16. The + default value is no IP addresses. + /para +/listitem + /varlistentry + + varlistentry +termvarnameArpAllTargets=/varname/term +listitem + paraSpecifies the quantity of ArpIpTargets that must be reachable + in order for the ARP monitor to consider a slave as being up. + This option affects only active-backup mode for slaves with + ArpValidate enabled. Possible values are + literalany/literal, + literalall/literal + /para +/listitem + /varlistentry + + varlistentry +termvarnamePrimaryReselect=/varname/term +listitem + paraSpecifies the reselection policy for the primary slave. This + affects how the primary slave is chosen to become the active slave + when failure of the active slave or recovery of the primary slave + occurs. This option is designed to prevent flip-flopping between + the primary slave and other slaves. Possible values are + literalalways/literal, +
[systemd-devel] [PATCH] networkd vxlan: Add support for enabling UDP checksums
Add UDPCheckSum option to enable transmitting UDP checksums when doing VXLAN/IPv4. Add UDP6ZeroChecksumRx, and UDP6ZeroChecksumTx options to enable sending zero checksums and receiving zero checksums in VXLAN/IPv6 V2: rename Udp to UDP --- man/systemd.netdev.xml | 20 +++- src/network/networkd-netdev-gperf.gperf | 3 +++ src/network/networkd-netdev-vxlan.c | 27 +++ src/network/networkd-netdev-vxlan.h | 3 +++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index e278aa1..7800dc4 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -391,7 +391,25 @@ paraA boolean. When true route short circuit is turned on./para /listitem /varlistentry -/variablelist +varlistentry + termvarnameUDPCheckSum=/varname/term +listitem +paraA boolean. When true transmitting UDP checksums when doing VXLAN/IPv4 is turned on./para +/listitem +/varlistentry +varlistentry + termvarnameUDP6ZeroChecksumTx=/varname/term +listitem + paraA boolean. When true sending zero checksums in VXLAN/IPv6 is turned on./para +/listitem +/varlistentry +varlistentry + termvarnameUDP6ZeroCheckSumRx=/varname/term +listitem + paraA boolean. When true receiving zero checksums in VXLAN/IPv6 is turned on./para +/listitem +/varlistentry + /variablelist /refsect1 refsect1 title[Tunnel] Section Options/title diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 963c47c..c06344c 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -47,6 +47,9 @@ VXLAN.ARPProxy, config_parse_bool, 0, VXLAN.L2MissNotification, config_parse_bool, 0, offsetof(VxLan, l2miss) VXLAN.L3MissNotification, config_parse_bool, 0, offsetof(VxLan, l3miss) VXLAN.RouteShortCircuit, config_parse_bool, 0, offsetof(VxLan, route_short_circuit) +VXLAN.UDPCheckSum,config_parse_bool, 0, offsetof(VxLan, udpcsum) +VXLAN.UDP6ZeroCheckSumRx, config_parse_bool, 0, offsetof(VxLan, udp6zerocsumrx) +VXLAN.UDP6ZeroCheckSumTx, config_parse_bool, 0, offsetof(VxLan, udp6zerocsumtx) VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) Tun.OneQueue, config_parse_bool, 0, offsetof(TunTap, one_queue) Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue) diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c index d5128cb..d9b13e3 100644 --- a/src/network/networkd-netdev-vxlan.c +++ b/src/network/networkd-netdev-vxlan.c @@ -135,6 +135,30 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ } } +r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v-udpcsum); +if (r 0) { +log_netdev_error(netdev, + Could not append IFLA_VXLAN_UDP_CSUM attribute: %s, + strerror(-r)); +return r; +} + +r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v-udp6zerocsumtx); +if (r 0) { +log_netdev_error(netdev, + Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %s, + strerror(-r)); +return r; +} + +r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v-udp6zerocsumrx); +if (r 0) { +log_netdev_error(netdev, + Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %s, +
Re: [systemd-devel] [PATCH] networkd vxlan: Add support for enabling UDP checksums
On Thu, 05 Mar 2015 16:51:37 +0530, Lennart Poettering lenn...@poettering.net wrote: On Thu, 05.03.15 14:05, Susant Sahani (sus...@redhat.com) wrote: Add UdpCheckSum option to enable transmitting UDP checksums when doing VXLAN/IPv4. Add Udp6ZeroChecksumRx, and Udp6ZeroChecksumTx options to enable sending zero checksums and receiving zero checksums in VXLAN/IPv6 I think useing the capitalization UDPCheckSum= instead of UdpCheckSum= would be more in line with how we capitalize this otherwise. (Also, indentation problems in the man page...) Yes renamed to UDP and fixed indentation . Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd-networkd and bonding config
On Thu, 05 Mar 2015 21:01:53 +0530, Michał Bartoszkiewicz mbartoszkiew...@gmail.com wrote: On Thu, Mar 5, 2015 at 3:47 PM, Tom Gundersen t...@jklm.no wrote: The kernel creates bond0 itself. This is confusing and we should probably request the kernel to stop doing that (patch needed). You can use options bonding max_bonds=0 to disable the creation of bond0. this options is not a netlink parameter.networkd does not use module parameters I guess. Specifically to use it we need to add /etc/modprobe.d/bonding.conf options bonding max_bonds=0 Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd vxlan: Add support for enabling UDP checksums
Add UdpCheckSum option to enable transmitting UDP checksums when doing VXLAN/IPv4. Add Udp6ZeroChecksumRx, and Udp6ZeroChecksumTx options to enable sending zero checksums and receiving zero checksums in VXLAN/IPv6 --- man/systemd.netdev.xml | 24 +++- src/libsystemd/sd-rtnl/rtnl-types.c | 3 +++ src/network/networkd-netdev-gperf.gperf | 3 +++ src/network/networkd-netdev-vxlan.c | 27 +++ src/network/networkd-netdev-vxlan.h | 3 +++ 5 files changed, 59 insertions(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index e278aa1..9304ce2 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -391,7 +391,29 @@ paraA boolean. When true route short circuit is turned on./para /listitem /varlistentry -/variablelist +varlistentry + termvarnameUdpCheckSum=/varname/term +listitem + paraA boolean. When true transmitting UDP checksums when doing + VXLAN/IPv4 is turned on. The default value is false./para +/listitem +/varlistentry +varlistentry + termvarnameUdp6ZeroCheckSumTx=/varname/term +listitem + paraA boolean. When true sending zero checksums in VXLAN/IPv6 is turned on. + The default value is false./para +/listitem +/varlistentry +varlistentry + termvarnameUdp6ZeroCheckSumRx=/varname/term + listitem +paraA boolean. When true receiving zero checksums in VXLAN/IPv6 is turned on. +The default value is false.//para + /listitem +/varlistentry + + /variablelist /refsect1 refsect1 title[Tunnel] Section Options/title diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index d4abe4c..95924cd 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -89,6 +89,9 @@ static const NLType rtnl_link_info_data_vxlan_types[IFLA_VXLAN_MAX+1] = { [IFLA_VXLAN_RSC] = { .type = NLA_U8 }, [IFLA_VXLAN_L2MISS] = { .type = NLA_U8 }, [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 }, +[IFLA_VXLAN_UDP_CSUM] = { .type = NLA_U8 }, +[IFLA_VXLAN_UDP_ZERO_CSUM6_TX] = { .type = NLA_U8 }, +[IFLA_VXLAN_UDP_ZERO_CSUM6_RX] = { .type = NLA_U8 }, }; static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = { diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 963c47c..7a9fbf8 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -47,6 +47,9 @@ VXLAN.ARPProxy, config_parse_bool, 0, VXLAN.L2MissNotification, config_parse_bool, 0, offsetof(VxLan, l2miss) VXLAN.L3MissNotification, config_parse_bool, 0, offsetof(VxLan, l3miss) VXLAN.RouteShortCircuit, config_parse_bool, 0, offsetof(VxLan, route_short_circuit) +VXLAN.UdpCheckSum,config_parse_bool, 0, offsetof(VxLan, udpcsum) +VXLAN.Udp6ZeroCheckSumRx, config_parse_bool, 0, offsetof(VxLan, udp6zerocsumrx) +VXLAN.Udp6ZeroCheckSumTx, config_parse_bool, 0, offsetof(VxLan, udp6zerocsumtx) VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) Tun.OneQueue, config_parse_bool, 0, offsetof(TunTap, one_queue) Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue) diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c index d5128cb..d9b13e3 100644 --- a/src/network/networkd-netdev-vxlan.c +++ b/src/network/networkd-netdev-vxlan.c @@ -135,6 +135,30 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ } } +r =
Re: [systemd-devel] [PATCH] journald: Introduce RFC 5424 syslog
On Fri, 20 Feb 2015 22:14:20 +0530, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Thu, Feb 19, 2015 at 12:10:04PM +0100, Lennart Poettering wrote: On Thu, 19.02.15 13:28, Susant Sahani (sus...@redhat.com) wrote: This patch adds support for RFC 5424 syslog format to journald. Journald can now forward logs to a multicast UDP group. RFC 5424 format: PRIVERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP [SD-ID]s SP MSG Hmm, wasn't the last proposal we discussed to do this in an auxiliary daemmon, possibly in systemd-journal-upload or so, but not in journald? We discussed both... From http://lists.freedesktop.org/archives/systemd-devel/2014-December/026202.html: Having this in systems-journald and extend the forward to syslog config with the target host was our expectation anyway. The difference is in how the logs are accessed: if journald itself does the jobs, they would be forwarded live. If anything else, the uploader would be a client which reads the files in /var/log/journal/. The are advantages to both solutions: the first one might be more robust if writing the logs fails or stops for whatever reason. The second one will probably send more logs, because sending of logs can be delayed until the network is up. In the second version, the uploader can also forward logs from other machines (containers). Now that I spelled it out, the second version seems nicer. After rereading the old discussion, I have to agree with Lennart that *not* doing it in systemd-journald directly seems better. Reasons below... I see two problems with journald: first of all, for security reasons I am conservative about making it deal with the network directly. Opening up such a basic daemon to the network is a something i'd prefer to avoid. I don't see how opening a socket to send UDP messages is dangerous. But yeah, sd-journald runs as root with full capabilities. sd-journal-upload runs as an unprivileged user. The other thing is that journald runs really really early during boot, at a time where the network is unlikely to be up. This means that early boot msgs could never be delivered via syslog... And this is a convincing argument for me. Essentially, by doing it in a separate tool we get reliability which we could never have with journald. I'd really prefer a scheme where this syslog broadcaster can be run relatively late at boot and where it tries to repeatedly send the messages, until sendmsg() actually succeeds. i.e. using the journal cursor logic it would not send a log message until the point where the previous message was delivered with a successful sendmsg(). Wth such a scheme all early boot msgs would be dumped on the network the moment the network is up. Zbigniew, do you have more ideas about this? Yep, sounds right. Susant, sorry! I think we should at look at adding this to sd-journal-upload, or a separate similar tool which reuses some code of sd-journal-upload. Yes :) . I will start working on it. just have to plug in this patch with the new daemon. Susant ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] journal: Introduce journal-syslogd
This tiny daemon enables to pull journal entries and push to a UDP multicast address in syslog RFC 5424 format. systemd-journal-syslogd runs with own user systemd-journal-syslog. It starts running after the network is up. V2: Address Zbigniew's comments 1. Rename binary systemd-journal-syslogd 2. Fixed up man and added example 3. Error code check sd_event_add_signal 4. remove +User=systemd-journal-network from service file 5. remove opterr=0 6. assignment into declaration of mh --- Makefile-man.am | 8 + Makefile.am | 37 ++ man/systemd-journal-syslogd.service.xml | 84 + man/systemd-journal-syslogd.xml | 146 src/journal-remote/journal-syslog-conf.c | 61 src/journal-remote/journal-syslog-conf.h | 39 ++ src/journal-remote/journal-syslog-gperf.gperf | 18 + src/journal-remote/journal-syslog-manager.c | 491 ++ src/journal-remote/journal-syslog-manager.h | 70 src/journal-remote/journal-syslog-network.c | 218 src/journal-remote/journal-syslogd.c | 217 src/journal-remote/journal-syslogd.conf.in| 2 + units/systemd-journal-syslogd.service | 18 + 13 files changed, 1409 insertions(+) create mode 100644 man/systemd-journal-syslogd.service.xml create mode 100644 man/systemd-journal-syslogd.xml create mode 100644 src/journal-remote/journal-syslog-conf.c create mode 100644 src/journal-remote/journal-syslog-conf.h create mode 100644 src/journal-remote/journal-syslog-gperf.gperf create mode 100644 src/journal-remote/journal-syslog-manager.c create mode 100644 src/journal-remote/journal-syslog-manager.h create mode 100644 src/journal-remote/journal-syslog-network.c create mode 100644 src/journal-remote/journal-syslogd.c create mode 100644 src/journal-remote/journal-syslogd.conf.in create mode 100644 units/systemd-journal-syslogd.service diff --git a/Makefile-man.am b/Makefile-man.am index ab1db33..80584b7 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -1374,6 +1374,14 @@ man/systemd-journal-gatewayd.socket.html: man/systemd-journal-gatewayd.service.h endif +MANPAGES += \ +man/systemd-journal-syslogd.service.8 \ +man/systemd-journal-syslogd.8 +MANPAGES_ALIAS += \ +man/systemd-journal-syslogd.8 +man/systemd-journal-syslogd.8: man/systemd-journal-syslogd.service.8 +man/systemd-journal-syslogd.html: man/systemd-journal-syslogd.service.html + if HAVE_MYHOSTNAME MANPAGES += \ man/nss-myhostname.8 diff --git a/Makefile.am b/Makefile.am index 856accb..e0b985a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4336,6 +4336,43 @@ EXTRA_DIST += \ src/journal-remote/journal-upload.conf.in endif +systemd_journal_syslogd_SOURCES = \ + src/journal-remote/journal-syslog-manager.h \ + src/journal-remote/journal-syslog-manager.c \ + src/journal-remote/journal-syslog-conf.h \ + src/journal-remote/journal-syslog-conf.c \ + src/journal-remote/journal-syslog-network.c \ + src/journal-remote/journal-syslogd.c + +nodist_systemd_journal_syslogd_SOURCES = \ + src/journal-remote/journal-syslog-gperf.c + +EXTRA_DIST += \ +src/journal-remote/journal-syslog-gperf.gperf + +CLEANFILES += \ +src/journal-remote/journal-syslog-gperf.c + +systemd_journal_syslogd_LDADD = \ + libsystemd-internal.la \ + libsystemd-journal-internal.la \ + libsystemd-shared.la + +rootlibexec_PROGRAMS += \ + systemd-journal-syslogd + +nodist_systemunit_DATA += \ + units/systemd-journal-syslogd.service + +EXTRA_DIST += \ + units/systemd-journal-syslogd.service.in + +nodist_pkgsysconf_DATA += \ + src/journal-remote/journal-syslogd.conf + +EXTRA_DIST += \ + src/journal-remote/journal-syslogd.conf.in + # using _CFLAGS = in the conditional below would suppress AM_CFLAGS journalctl_CFLAGS = \ $(AM_CFLAGS) diff --git a/man/systemd-journal-syslogd.service.xml b/man/systemd-journal-syslogd.service.xml new file mode 100644 index 000..b540499 --- /dev/null +++ b/man/systemd-journal-syslogd.service.xml @@ -0,0 +1,84 @@ +?xml version='1.0'? !--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN +http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; + +!-- + This file is part of systemd. + + Copyright 2015 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License
[systemd-devel] [PATCH] networkd man: fix man and config name.
Rename bond confs and man as well. --- man/systemd.netdev.xml | 28 src/network/networkd-netdev-gperf.gperf | 124 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 3e65f2e..24e2d26 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -666,7 +666,7 @@ /varlistentry varlistentry -termvarnameLearnPacketIntvSec,=/varname/term +termvarnameLearnPacketIntervalSec,=/varname/term listitem paraSpecifies the number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch. @@ -687,7 +687,7 @@ /varlistentry varlistentry -termvarnameFailOverMac=/varname/term +termvarnameFailOverMACPolicy=/varname/term listitem paraSpecifies whether active-backup mode should set all slaves to the same MAC address at enslavement or, when enabled, perform special handling of the @@ -701,10 +701,10 @@ /varlistentry varlistentry -termvarnameArpValidate=/varname/term +termvarnameARPValidate=/varname/term listitem paraSpecifies whether or not ARP probes and replies should be - validated in any mode that supports arp monitoring, or whether + validated in any mode that supports ARP monitoring, or whether non-ARP traffic should be filtered (disregarded) for link monitoring purposes. Possible values are literalnone/literal, @@ -716,7 +716,7 @@ /varlistentry varlistentry -termvarnameArpIntervalSec=/varname/term +termvarnameARPIntervalSec=/varname/term listitem paraSpecifies the ARP link monitoring frequency in milliseconds. A value of 0 disables ARP monitoring. The default value is 0. @@ -725,10 +725,10 @@ /varlistentry varlistentry -termvarnameArpIpTargets=/varname/term +termvarnameARPIPTargets=/varname/term listitem paraSpecifies the IP addresses to use as ARP monitoring peers when - ArpIntervalSec is greater than 0. These are the targets of the ARP request + ARPIntervalSec is greater than 0. These are the targets of the ARP request sent to determine the health of the link to the targets. Specify these values in ipv4 dotted decimal format. At least one IP address must be given for ARP monitoring to function. The @@ -739,12 +739,12 @@ /varlistentry varlistentry -termvarnameArpAllTargets=/varname/term +termvarnameARPAllTargets=/varname/term listitem - paraSpecifies the quantity of ArpIpTargets that must be reachable + paraSpecifies the quantity of ARPIPTargets that must be reachable in order for the ARP monitor to consider a slave as being up. This option affects only active-backup mode for slaves with - ArpValidate enabled. Possible values are + ARPValidate enabled. Possible values are literalany/literal, literalall/literal /para @@ -752,7 +752,7 @@ /varlistentry varlistentry -termvarnamePrimaryReselect=/varname/term +termvarnamePrimaryReselectPolicy=/varname/term listitem paraSpecifies the reselection policy for the primary slave. This affects how the primary slave is chosen to become the active slave @@ -791,16 +791,16 @@ /varlistentry varlistentry -termvarnameNumGratuitousARP=/varname/term +termvarnameGratuitousARP=/varname/term listitem paraSpecify the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a failover event. As soon as the link is up on the new slave a peer notification is sent on the bonding device and each VLAN sub-device. This is repeated at each link monitor interval -(ArpIntervalSec or MIIMonitorSec, whichever is active) if the number is +(ARPIntervalSec or MIIMonitorSec, whichever is active) if the number is greater than 1. The valid range is (0 - 255). Default value is 1. -These options affect only the active-backup mode +These options affect only the active-backup mode. /para /listitem /varlistentry diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf index 72ab2f4..66ed2e0 100644 --- a/src/network/networkd-netdev-gperf.gperf +++ b/src/network/networkd-netdev-gperf.gperf @@ -18,65 +18,65 @@ struct ConfigPerfItem; %struct-type %includes %% -Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev,
[systemd-devel] [PATCH] journal: Introduce journal-netlogd
a/man/journal-netlogd.conf.xml b/man/journal-netlogd.conf.xml new file mode 100644 index 000..186178c --- /dev/null +++ b/man/journal-netlogd.conf.xml @@ -0,0 +1,115 @@ +?xml version='1.0'? !--*-nxml-*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN + http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; + +!-- + This file is part of systemd. + + Copyright 2015 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +-- + +refentry id=journal-netlogd.conf xmlns:xi=http://www.w3.org/2001/XInclude; + refentryinfo +titlejournal-netlogd.conf/title +productnamesystemd/productname + +authorgroup + author +contribDeveloper/contrib +firstnameSusant/firstname +surnameSahani/surname +emailssah...@gmail.com/email + /author +/authorgroup + /refentryinfo + + refmeta +refentrytitlejournal-netlogd.conf/refentrytitle +manvolnum5/manvolnum + /refmeta + + refnamediv +refnamejournal-netlogd.conf/refname +refnamejournal-netlogd.conf.d/refname +refpurposeJournal netlogd service configuration files/refpurpose + /refnamediv + + refsynopsisdiv +parafilename/etc/systemd/journal-netlogd.conf/filename/para +parafilename/etc/systemd/journald.conf.d/*.conf/filename/para +parafilename/run/systemd/journald.conf.d/*.conf/filename/para +parafilename/usr/lib/systemd/journald.conf.d/*.conf/filename/para + /refsynopsisdiv + + refsect1 +titleDescription/title + +paraThese files configure various parameters of the systemd-journal-netlogd +application, + citerefentryrefentrytitlesystemd-journal-netlogd/refentrytitlemanvolnum8/manvolnum/citerefentry./para + /refsect1 + + refsect1 +title[Network] Section Options/title + +paraThe literal[Network]/literal section only applies for +UDP multicast address and Port:/para + +variablelist class='network-directives' + varlistentry +termvarnameAddress=/varname/term +listitemparaControls whether log messages received by the +journal daemon shall be forwarded to a unicast UDP address or multicast UDP network +group in syslog RFC 5424 format./para + +paraThe the address string format is similar to socket units. See + citerefentryrefentrytitlesystemd.socket/refentrytitlemanvolnum1/manvolnum/citerefentry +/para +/listitem + /varlistentry +/variablelist + /refsect1 + + refsect1 +titleExample/title +example + title/etc/systemd/journal-netlogd.conf/title + programlisting[Network] +Address=239.0.0.1:6000 + /programlisting +/example + /refsect1 + +refsect1 +titleExample/title +example + title/etc/systemd/journal-netlogd.conf/title + programlisting[Network] +Address=192.168.8.101:514 + /programlisting +/example + /refsect1 + + refsect1 + titleSee Also/title + para + citerefentryrefentrytitlesystemd-journal-netlogd/refentrytitlemanvolnum1/manvolnum/citerefentry, + citerefentryrefentrytitlesystemd/refentrytitlemanvolnum1/manvolnum/citerefentry, + citerefentryrefentrytitlesystemd-journald.service/refentrytitlemanvolnum8/manvolnum/citerefentry + /para + /refsect1 + +/refentry diff --git a/man/systemd-journal-netlogd.xml b/man/systemd-journal-netlogd.xml new file mode 100644 index 000..f2e953b --- /dev/null +++ b/man/systemd-journal-netlogd.xml @@ -0,0 +1,123 @@ +?xml version='1.0'? !--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN +http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; + +!-- + This file is part of systemd. + + Copyright 2015 Susant Sahani + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses