Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * include/uapi/linux/if_macsec.h - MACsec device |
| 3 | * |
| 4 | * Copyright (c) 2015 Sabrina Dubroca <sd@queasysnail.net> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _UAPI_MACSEC_H |
| 13 | #define _UAPI_MACSEC_H |
| 14 | |
| 15 | #include <linux/types.h> |
| 16 | |
| 17 | #define MACSEC_GENL_NAME "macsec" |
| 18 | #define MACSEC_GENL_VERSION 1 |
| 19 | |
| 20 | #define MACSEC_MAX_KEY_LEN 128 |
| 21 | |
Sabrina Dubroca | 8acca6a | 2016-05-07 20:19:29 +0200 | [diff] [blame] | 22 | #define MACSEC_KEYID_LEN 16 |
| 23 | |
Sabrina Dubroca | 7481648 | 2016-04-22 11:28:08 +0200 | [diff] [blame] | 24 | #define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL |
| 25 | #define MACSEC_DEFAULT_CIPHER_ALT 0x0080C20001000001ULL |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 26 | |
| 27 | #define MACSEC_MIN_ICV_LEN 8 |
| 28 | #define MACSEC_MAX_ICV_LEN 32 |
Davide Caratti | 2ccbe2c | 2016-07-22 15:07:56 +0200 | [diff] [blame] | 29 | /* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ |
| 30 | #define MACSEC_STD_ICV_LEN 16 |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 31 | |
| 32 | enum macsec_attrs { |
| 33 | MACSEC_ATTR_UNSPEC, |
| 34 | MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */ |
| 35 | MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */ |
| 36 | MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */ |
| 37 | MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */ |
| 38 | MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */ |
| 39 | MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */ |
| 40 | MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */ |
| 41 | MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */ |
| 42 | __MACSEC_ATTR_END, |
| 43 | NUM_MACSEC_ATTR = __MACSEC_ATTR_END, |
| 44 | MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1, |
| 45 | }; |
| 46 | |
| 47 | enum macsec_secy_attrs { |
| 48 | MACSEC_SECY_ATTR_UNSPEC, |
| 49 | MACSEC_SECY_ATTR_SCI, |
| 50 | MACSEC_SECY_ATTR_ENCODING_SA, |
| 51 | MACSEC_SECY_ATTR_WINDOW, |
| 52 | MACSEC_SECY_ATTR_CIPHER_SUITE, |
| 53 | MACSEC_SECY_ATTR_ICV_LEN, |
| 54 | MACSEC_SECY_ATTR_PROTECT, |
| 55 | MACSEC_SECY_ATTR_REPLAY, |
| 56 | MACSEC_SECY_ATTR_OPER, |
| 57 | MACSEC_SECY_ATTR_VALIDATE, |
| 58 | MACSEC_SECY_ATTR_ENCRYPT, |
| 59 | MACSEC_SECY_ATTR_INC_SCI, |
| 60 | MACSEC_SECY_ATTR_ES, |
| 61 | MACSEC_SECY_ATTR_SCB, |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 62 | MACSEC_SECY_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 63 | __MACSEC_SECY_ATTR_END, |
| 64 | NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END, |
| 65 | MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1, |
| 66 | }; |
| 67 | |
| 68 | enum macsec_rxsc_attrs { |
| 69 | MACSEC_RXSC_ATTR_UNSPEC, |
| 70 | MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */ |
| 71 | MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */ |
| 72 | MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */ |
| 73 | MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */ |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 74 | MACSEC_RXSC_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 75 | __MACSEC_RXSC_ATTR_END, |
| 76 | NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END, |
| 77 | MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1, |
| 78 | }; |
| 79 | |
| 80 | enum macsec_sa_attrs { |
| 81 | MACSEC_SA_ATTR_UNSPEC, |
| 82 | MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */ |
| 83 | MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */ |
| 84 | MACSEC_SA_ATTR_PN, /* config/dump, u32 */ |
| 85 | MACSEC_SA_ATTR_KEY, /* config, data */ |
Sabrina Dubroca | 8acca6a | 2016-05-07 20:19:29 +0200 | [diff] [blame] | 86 | MACSEC_SA_ATTR_KEYID, /* config/dump, 128-bit */ |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 87 | MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */ |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 88 | MACSEC_SA_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 89 | __MACSEC_SA_ATTR_END, |
| 90 | NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END, |
| 91 | MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1, |
| 92 | }; |
| 93 | |
| 94 | enum macsec_nl_commands { |
| 95 | MACSEC_CMD_GET_TXSC, |
| 96 | MACSEC_CMD_ADD_RXSC, |
| 97 | MACSEC_CMD_DEL_RXSC, |
| 98 | MACSEC_CMD_UPD_RXSC, |
| 99 | MACSEC_CMD_ADD_TXSA, |
| 100 | MACSEC_CMD_DEL_TXSA, |
| 101 | MACSEC_CMD_UPD_TXSA, |
| 102 | MACSEC_CMD_ADD_RXSA, |
| 103 | MACSEC_CMD_DEL_RXSA, |
| 104 | MACSEC_CMD_UPD_RXSA, |
| 105 | }; |
| 106 | |
| 107 | /* u64 per-RXSC stats */ |
| 108 | enum macsec_rxsc_stats_attr { |
| 109 | MACSEC_RXSC_STATS_ATTR_UNSPEC, |
| 110 | MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED, |
| 111 | MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED, |
| 112 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED, |
| 113 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED, |
| 114 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK, |
| 115 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID, |
| 116 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE, |
| 117 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID, |
| 118 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA, |
| 119 | MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA, |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 120 | MACSEC_RXSC_STATS_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 121 | __MACSEC_RXSC_STATS_ATTR_END, |
| 122 | NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END, |
| 123 | MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1, |
| 124 | }; |
| 125 | |
| 126 | /* u32 per-{RX,TX}SA stats */ |
| 127 | enum macsec_sa_stats_attr { |
| 128 | MACSEC_SA_STATS_ATTR_UNSPEC, |
| 129 | MACSEC_SA_STATS_ATTR_IN_PKTS_OK, |
| 130 | MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID, |
| 131 | MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID, |
| 132 | MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA, |
| 133 | MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA, |
| 134 | MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED, |
| 135 | MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED, |
| 136 | __MACSEC_SA_STATS_ATTR_END, |
| 137 | NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END, |
| 138 | MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1, |
| 139 | }; |
| 140 | |
| 141 | /* u64 per-TXSC stats */ |
| 142 | enum macsec_txsc_stats_attr { |
| 143 | MACSEC_TXSC_STATS_ATTR_UNSPEC, |
| 144 | MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED, |
| 145 | MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED, |
| 146 | MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED, |
| 147 | MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED, |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 148 | MACSEC_TXSC_STATS_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 149 | __MACSEC_TXSC_STATS_ATTR_END, |
| 150 | NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END, |
| 151 | MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1, |
| 152 | }; |
| 153 | |
| 154 | /* u64 per-SecY stats */ |
| 155 | enum macsec_secy_stats_attr { |
| 156 | MACSEC_SECY_STATS_ATTR_UNSPEC, |
| 157 | MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED, |
| 158 | MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED, |
| 159 | MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG, |
| 160 | MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG, |
| 161 | MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG, |
| 162 | MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI, |
| 163 | MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI, |
| 164 | MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN, |
Nicolas Dichtel | f60d94c | 2016-04-26 10:06:11 +0200 | [diff] [blame] | 165 | MACSEC_SECY_STATS_ATTR_PAD, |
Sabrina Dubroca | dece8d2 | 2016-03-11 18:07:31 +0100 | [diff] [blame] | 166 | __MACSEC_SECY_STATS_ATTR_END, |
| 167 | NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END, |
| 168 | MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1, |
| 169 | }; |
| 170 | |
| 171 | #endif /* _UAPI_MACSEC_H */ |