@@ -66,6 +66,7 @@ static const struct nla_policy tunnel_key_policy[TCA_TUNNEL_KEY_MAX + 1] = {
66
66
[TCA_TUNNEL_KEY_ENC_IPV6_SRC ] = { .len = sizeof (struct in6_addr ) },
67
67
[TCA_TUNNEL_KEY_ENC_IPV6_DST ] = { .len = sizeof (struct in6_addr ) },
68
68
[TCA_TUNNEL_KEY_ENC_KEY_ID ] = { .type = NLA_U32 },
69
+ [TCA_TUNNEL_KEY_ENC_DST_PORT ] = {.type = NLA_U16 },
69
70
};
70
71
71
72
static int tunnel_key_init (struct net * net , struct nlattr * nla ,
@@ -80,6 +81,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
80
81
struct tc_tunnel_key * parm ;
81
82
struct tcf_tunnel_key * t ;
82
83
bool exists = false;
84
+ __be16 dst_port = 0 ;
83
85
__be64 key_id ;
84
86
int ret = 0 ;
85
87
int err ;
@@ -110,6 +112,9 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
110
112
111
113
key_id = key32_to_tunnel_id (nla_get_be32 (tb [TCA_TUNNEL_KEY_ENC_KEY_ID ]));
112
114
115
+ if (tb [TCA_TUNNEL_KEY_ENC_DST_PORT ])
116
+ dst_port = nla_get_be16 (tb [TCA_TUNNEL_KEY_ENC_DST_PORT ]);
117
+
113
118
if (tb [TCA_TUNNEL_KEY_ENC_IPV4_SRC ] &&
114
119
tb [TCA_TUNNEL_KEY_ENC_IPV4_DST ]) {
115
120
__be32 saddr ;
@@ -119,7 +124,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
119
124
daddr = nla_get_in_addr (tb [TCA_TUNNEL_KEY_ENC_IPV4_DST ]);
120
125
121
126
metadata = __ip_tun_set_dst (saddr , daddr , 0 , 0 ,
122
- 0 , TUNNEL_KEY , key_id , 0 );
127
+ dst_port , TUNNEL_KEY ,
128
+ key_id , 0 );
123
129
} else if (tb [TCA_TUNNEL_KEY_ENC_IPV6_SRC ] &&
124
130
tb [TCA_TUNNEL_KEY_ENC_IPV6_DST ]) {
125
131
struct in6_addr saddr ;
@@ -129,7 +135,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
129
135
daddr = nla_get_in6_addr (tb [TCA_TUNNEL_KEY_ENC_IPV6_DST ]);
130
136
131
137
metadata = __ipv6_tun_set_dst (& saddr , & daddr , 0 , 0 , 0 ,
132
- 0 , TUNNEL_KEY , key_id , 0 );
138
+ dst_port , TUNNEL_KEY ,
139
+ key_id , 0 );
133
140
}
134
141
135
142
if (!metadata ) {
@@ -257,7 +264,8 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a,
257
264
258
265
if (nla_put_be32 (skb , TCA_TUNNEL_KEY_ENC_KEY_ID , key_id ) ||
259
266
tunnel_key_dump_addresses (skb ,
260
- & params -> tcft_enc_metadata -> u .tun_info ))
267
+ & params -> tcft_enc_metadata -> u .tun_info ) ||
268
+ nla_put_be16 (skb , TCA_TUNNEL_KEY_ENC_DST_PORT , key -> tp_dst ))
261
269
goto nla_put_failure ;
262
270
}
263
271
0 commit comments