Skip to content

Commit 24ba898

Browse files
hadarhenziondavem330
authored andcommitted
net/dst: Add dst port to dst_metadata utility functions
Add dst port parameter to __ip_tun_set_dst and __ipv6_tun_set_dst utility functions. Signed-off-by: Hadar Hen Zion <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f4d997f commit 24ba898

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

include/net/dst_metadata.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ static inline struct ip_tunnel_info *skb_tunnel_info_unclone(struct sk_buff *skb
115115
static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
116116
__be32 daddr,
117117
__u8 tos, __u8 ttl,
118+
__be16 tp_dst,
118119
__be16 flags,
119120
__be64 tunnel_id,
120121
int md_size)
@@ -127,7 +128,7 @@ static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
127128

128129
ip_tunnel_key_init(&tun_dst->u.tun_info.key,
129130
saddr, daddr, tos, ttl,
130-
0, 0, 0, tunnel_id, flags);
131+
0, 0, tp_dst, tunnel_id, flags);
131132
return tun_dst;
132133
}
133134

@@ -139,12 +140,13 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb,
139140
const struct iphdr *iph = ip_hdr(skb);
140141

141142
return __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl,
142-
flags, tunnel_id, md_size);
143+
0, flags, tunnel_id, md_size);
143144
}
144145

145146
static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *saddr,
146147
const struct in6_addr *daddr,
147148
__u8 tos, __u8 ttl,
149+
__be16 tp_dst,
148150
__be32 label,
149151
__be16 flags,
150152
__be64 tunnel_id,
@@ -162,7 +164,7 @@ static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *sad
162164
info->key.tun_flags = flags;
163165
info->key.tun_id = tunnel_id;
164166
info->key.tp_src = 0;
165-
info->key.tp_dst = 0;
167+
info->key.tp_dst = tp_dst;
166168

167169
info->key.u.ipv6.src = *saddr;
168170
info->key.u.ipv6.dst = *daddr;
@@ -183,7 +185,7 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb,
183185

184186
return __ipv6_tun_set_dst(&ip6h->saddr, &ip6h->daddr,
185187
ipv6_get_dsfield(ip6h), ip6h->hop_limit,
186-
ip6_flowlabel(ip6h), flags, tunnel_id,
188+
0, ip6_flowlabel(ip6h), flags, tunnel_id,
187189
md_size);
188190
}
189191
#endif /* __NET_DST_METADATA_H */

net/sched/act_tunnel_key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
119119
daddr = nla_get_in_addr(tb[TCA_TUNNEL_KEY_ENC_IPV4_DST]);
120120

121121
metadata = __ip_tun_set_dst(saddr, daddr, 0, 0,
122-
TUNNEL_KEY, key_id, 0);
122+
0, TUNNEL_KEY, key_id, 0);
123123
} else if (tb[TCA_TUNNEL_KEY_ENC_IPV6_SRC] &&
124124
tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]) {
125125
struct in6_addr saddr;
@@ -129,7 +129,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
129129
daddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
130130

131131
metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, 0,
132-
TUNNEL_KEY, key_id, 0);
132+
0, TUNNEL_KEY, key_id, 0);
133133
}
134134

135135
if (!metadata) {

0 commit comments

Comments
 (0)