summaryrefslogtreecommitdiff
path: root/lib/packets.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/packets.c')
-rw-r--r--lib/packets.c14
1 files changed, 2 insertions, 12 deletions
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