[systemd-devel] [PATCH 1/1] networkd: sit-tunnel add support for pmtudisc

Lennart Poettering lennart at poettering.net
Wed May 21 17:20:59 PDT 2014


On Wed, 21.05.14 14:43, Susant Sahani (susant at redhat.com) wrote:

> 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;

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".

>  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.

> --- 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;


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list