aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0beb413c01c4..39f151c7f251 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -140,6 +140,7 @@ struct xfrm_state {
140 140
141 struct xfrm_id id; 141 struct xfrm_id id;
142 struct xfrm_selector sel; 142 struct xfrm_selector sel;
143 struct xfrm_mark mark;
143 144
144 u32 genid; 145 u32 genid;
145 146
@@ -481,6 +482,7 @@ struct xfrm_policy {
481 482
482 u32 priority; 483 u32 priority;
483 u32 index; 484 u32 index;
485 struct xfrm_mark mark;
484 struct xfrm_selector selector; 486 struct xfrm_selector selector;
485 struct xfrm_lifetime_cfg lft; 487 struct xfrm_lifetime_cfg lft;
486 struct xfrm_lifetime_cur curlft; 488 struct xfrm_lifetime_cur curlft;
@@ -1570,4 +1572,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1570} 1572}
1571#endif 1573#endif
1572 1574
1575static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1576{
1577 if (attrs[XFRMA_MARK])
1578 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
1579 else
1580 m->v = m->m = 0;
1581
1582 return m->v & m->m;
1583}
1584
1585static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m)
1586{
1587 if (m->m | m->v)
1588 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
1589 return 0;
1590
1591nla_put_failure:
1592 return -1;
1593}
1594
1573#endif /* _NET_XFRM_H */ 1595#endif /* _NET_XFRM_H */