Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
35 lines
865 B
C
35 lines
865 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NET_NEXTHOP_H
|
|
#define __NET_NEXTHOP_H
|
|
|
|
#include <linux/rtnetlink.h>
|
|
#include <net/netlink.h>
|
|
|
|
static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining)
|
|
{
|
|
return remaining >= (int)sizeof(*rtnh) &&
|
|
rtnh->rtnh_len >= sizeof(*rtnh) &&
|
|
rtnh->rtnh_len <= remaining;
|
|
}
|
|
|
|
static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh,
|
|
int *remaining)
|
|
{
|
|
int totlen = NLA_ALIGN(rtnh->rtnh_len);
|
|
|
|
*remaining -= totlen;
|
|
return (struct rtnexthop *) ((char *) rtnh + totlen);
|
|
}
|
|
|
|
static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh)
|
|
{
|
|
return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh)));
|
|
}
|
|
|
|
static inline int rtnh_attrlen(const struct rtnexthop *rtnh)
|
|
{
|
|
return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh));
|
|
}
|
|
|
|
#endif
|