X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fpackets.c;h=5ad16b502ed50b9b6064fbacb11e0a891f47fa50;hb=12d0ee08a288ef170f5fed4da59a37bec98309f8;hp=fe06ac8a68f82a3e29628bce19ff68c9da8a0871;hpb=eea429d98ad54a02af007ad63ec8e9d143a8ee45;p=cascardo%2Fovs.git diff --git a/lib/packets.c b/lib/packets.c index fe06ac8a6..5ad16b502 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -39,23 +39,13 @@ const struct in6_addr in6addr_all_hosts = IN6ADDR_ALL_HOSTS_INIT; struct in6_addr flow_tnl_dst(const struct flow_tnl *tnl) { - struct in6_addr addr; - if (tnl->ip_dst) { - in6_addr_set_mapped_ipv4(&addr, tnl->ip_dst); - return addr; - } - return tnl->ipv6_dst; + return tnl->ip_dst ? in6_addr_mapped_ipv4(tnl->ip_dst) : tnl->ipv6_dst; } struct in6_addr flow_tnl_src(const struct flow_tnl *tnl) { - struct in6_addr addr; - if (tnl->ip_src) { - in6_addr_set_mapped_ipv4(&addr, tnl->ip_src); - return addr; - } - return tnl->ipv6_src; + return tnl->ip_src ? in6_addr_mapped_ipv4(tnl->ip_src) : tnl->ipv6_src; } /* Parses 's' as a 16-digit hexadecimal number representing a datapath ID. On