mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 09:41:44 +00:00
4e902c5741
Introduces struct fib_config replacing the ugly struct kern_rta prone to ordering issues. Avoids creating faked netlink messages for auto generated routes or requests via ioctl. A new interface net/nexthop.h is added to help navigate through nexthop configuration arrays. A new struct nl_info will be used to carry the necessary netlink information to be used for notifications later on. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
34 lines
821 B
C
34 lines
821 B
C
#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 >= 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
|