mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![David Ahern](/assets/img/avatar_default.png)
The header contains rtnh_ macros so rename the file accordingly. Allows a later patch to use the nexthop.h name for the new nexthop code. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
34 lines
859 B
C
34 lines
859 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NET_RTNH_H
|
|
#define __NET_RTNH_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
|