summaryrefslogtreecommitdiffstats
path: root/net/netfilter/nft_byteorder.c
diff options
context:
space:
mode:
authorAnder Juaristi <a@juaristi.eus>2019-08-17 13:17:52 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-08-26 11:01:00 +0200
commita1b840adafcbdc27da2982e7305c342204b8cfd8 (patch)
treecb6f52781580da3ff1e6efc0ac668ac2c69ffc83 /net/netfilter/nft_byteorder.c
parent0846e1616f0f3365cea732e82e2383932fe644e5 (diff)
downloadlinux-a1b840adafcbdc27da2982e7305c342204b8cfd8.tar.bz2
netfilter: nf_tables: Introduce new 64-bit helper register functions
Introduce new helper functions to load/store 64-bit values onto/from registers: - nft_reg_store64 - nft_reg_load64 This commit also re-orders all these helpers from smallest to largest target bit size. Signed-off-by: Ander Juaristi <a@juaristi.eus> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_byteorder.c')
-rw-r--r--net/netfilter/nft_byteorder.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/netfilter/nft_byteorder.c b/net/netfilter/nft_byteorder.c
index e06318428ea0..12bed3f7bbc6 100644
--- a/net/netfilter/nft_byteorder.c
+++ b/net/netfilter/nft_byteorder.c
@@ -43,14 +43,15 @@ void nft_byteorder_eval(const struct nft_expr *expr,
switch (priv->op) {
case NFT_BYTEORDER_NTOH:
for (i = 0; i < priv->len / 8; i++) {
- src64 = get_unaligned((u64 *)&src[i]);
- put_unaligned_be64(src64, &dst[i]);
+ src64 = nft_reg_load64(&src[i]);
+ nft_reg_store64(&dst[i], be64_to_cpu(src64));
}
break;
case NFT_BYTEORDER_HTON:
for (i = 0; i < priv->len / 8; i++) {
- src64 = get_unaligned_be64(&src[i]);
- put_unaligned(src64, (u64 *)&dst[i]);
+ src64 = (__force __u64)
+ cpu_to_be64(nft_reg_load64(&src[i]));
+ nft_reg_store64(&dst[i], src64);
}
break;
}