summaryrefslogtreecommitdiff
path: root/include/net/nexthop.h
blob: 3334dbfa5aa4b45ff76338fbd85819e85a7efe8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#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
://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-2/+4 2017-02-02netfilter: allow logging from non-init namespacesMichal Kubeček2-2/+2 2017-02-02netfilter: add and use nf_ct_set helperFlorian Westphal3-6/+3 2017-02-02skbuff: add and use skb_nfct helperFlorian Westphal4-8/+8 2017-02-02netfilter: reset netfilter state when duplicating packetFlorian Westphal1-1/+1 2017-02-02netfilter: conntrack: no need to pass ctinfo to error handlerFlorian Westphal1-6/+6