Skip to content

Commit ceba183

Browse files
hdmdaviespcmoore
authored andcommitted
calipso: Set the calipso socket label to match the secattr.
CALIPSO is a hop-by-hop IPv6 option. A lot of this patch is based on the equivalent CISPO code. The main difference is due to manipulating the options in the hop-by-hop header. Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 3faa8f9 commit ceba183

File tree

10 files changed

+728
-10
lines changed

10 files changed

+728
-10
lines changed

include/net/ipv6.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
319319

320320
bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb,
321321
const struct inet6_skb_parm *opt);
322+
struct ipv6_txoptions *ipv6_update_options(struct sock *sk,
323+
struct ipv6_txoptions *opt);
322324

323325
static inline bool ipv6_accept_ra(struct inet6_dev *idev)
324326
{

include/net/netlabel.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ struct netlbl_lsm_secattr {
226226
* @doi_getdef: returns a reference to a DOI
227227
* @doi_putdef: releases a reference of a DOI
228228
* @doi_walk: enumerate the DOI list
229+
* @sock_getattr: retrieve the socket's attr
230+
* @sock_setattr: set the socket's attr
231+
* @sock_delattr: remove the socket's attr
229232
*
230233
* Description:
231234
* This structure is filled out by the CALIPSO engine and passed
@@ -243,6 +246,12 @@ struct netlbl_calipso_ops {
243246
int (*doi_walk)(u32 *skip_cnt,
244247
int (*callback)(struct calipso_doi *doi_def, void *arg),
245248
void *cb_arg);
249+
int (*sock_getattr)(struct sock *sk,
250+
struct netlbl_lsm_secattr *secattr);
251+
int (*sock_setattr)(struct sock *sk,
252+
const struct calipso_doi *doi_def,
253+
const struct netlbl_lsm_secattr *secattr);
254+
void (*sock_delattr)(struct sock *sk);
246255
};
247256

248257
/*

include/uapi/linux/in6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ struct in6_flowlabel_req {
143143
#define IPV6_TLV_PAD1 0
144144
#define IPV6_TLV_PADN 1
145145
#define IPV6_TLV_ROUTERALERT 5
146+
#define IPV6_TLV_CALIPSO 7 /* RFC 5570 */
146147
#define IPV6_TLV_JUMBO 194
147148
#define IPV6_TLV_HAO 201 /* home address option */
148149

0 commit comments

Comments
 (0)