Skip to content

Commit c967a08

Browse files
tomratbertdavem330
authored andcommitted
mpls: Move reserved label definitions
Move to include/uapi/linux/mpls.h to be externally visibile. Signed-off-by: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bc321ed commit c967a08

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

include/uapi/linux/mpls.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ struct mpls_label {
3131
#define MPLS_LS_TTL_MASK 0x000000FF
3232
#define MPLS_LS_TTL_SHIFT 0
3333

34+
/* Reserved labels */
35+
#define MPLS_LABEL_IPV4_EXPLICIT_NULL 0 /* RFC3032 */
36+
#define MPLS_LABEL_ROUTER_ALERT 1 /* RFC3032 */
37+
#define MPLS_LABEL_IPV6_EXPLICIT_NULL 2 /* RFC3032 */
38+
#define MPLS_LABEL_IMPLICIT_NULL 3 /* RFC3032 */
39+
#define MPLS_LABEL_ENTROPY_INDICATOR 7 /* RFC6790 */
40+
#define MPLS_LABEL_GAL 13 /* RFC5586 */
41+
#define MPLS_LABEL_OAM_ALERT 14 /* RFC3429 */
42+
#define MPLS_LABEL_EXTENSION 15 /* RFC7274 */
43+
3444
#endif /* _UAPI_MPLS_H */

net/mpls/af_mpls.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ int nla_get_labels(const struct nlattr *nla,
647647
return -EINVAL;
648648

649649
switch (dec.label) {
650-
case LABEL_IMPLICIT_NULL:
650+
case MPLS_LABEL_IMPLICIT_NULL:
651651
/* RFC3032: This is a label that an LSR may
652652
* assign and distribute, but which never
653653
* actually appears in the encapsulation.
@@ -935,7 +935,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
935935
}
936936

937937
/* In case the predefined labels need to be populated */
938-
if (limit > LABEL_IPV4_EXPLICIT_NULL) {
938+
if (limit > MPLS_LABEL_IPV4_EXPLICIT_NULL) {
939939
struct net_device *lo = net->loopback_dev;
940940
rt0 = mpls_rt_alloc(lo->addr_len);
941941
if (!rt0)
@@ -945,7 +945,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)
945945
rt0->rt_via_table = NEIGH_LINK_TABLE;
946946
memcpy(rt0->rt_via, lo->dev_addr, lo->addr_len);
947947
}
948-
if (limit > LABEL_IPV6_EXPLICIT_NULL) {
948+
if (limit > MPLS_LABEL_IPV6_EXPLICIT_NULL) {
949949
struct net_device *lo = net->loopback_dev;
950950
rt2 = mpls_rt_alloc(lo->addr_len);
951951
if (!rt2)
@@ -973,15 +973,15 @@ static int resize_platform_label_table(struct net *net, size_t limit)
973973
memcpy(labels, old, cp_size);
974974

975975
/* If needed set the predefined labels */
976-
if ((old_limit <= LABEL_IPV6_EXPLICIT_NULL) &&
977-
(limit > LABEL_IPV6_EXPLICIT_NULL)) {
978-
RCU_INIT_POINTER(labels[LABEL_IPV6_EXPLICIT_NULL], rt2);
976+
if ((old_limit <= MPLS_LABEL_IPV6_EXPLICIT_NULL) &&
977+
(limit > MPLS_LABEL_IPV6_EXPLICIT_NULL)) {
978+
RCU_INIT_POINTER(labels[MPLS_LABEL_IPV6_EXPLICIT_NULL], rt2);
979979
rt2 = NULL;
980980
}
981981

982-
if ((old_limit <= LABEL_IPV4_EXPLICIT_NULL) &&
983-
(limit > LABEL_IPV4_EXPLICIT_NULL)) {
984-
RCU_INIT_POINTER(labels[LABEL_IPV4_EXPLICIT_NULL], rt0);
982+
if ((old_limit <= MPLS_LABEL_IPV4_EXPLICIT_NULL) &&
983+
(limit > MPLS_LABEL_IPV4_EXPLICIT_NULL)) {
984+
RCU_INIT_POINTER(labels[MPLS_LABEL_IPV4_EXPLICIT_NULL], rt0);
985985
rt0 = NULL;
986986
}
987987

net/mpls/internal.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#ifndef MPLS_INTERNAL_H
22
#define MPLS_INTERNAL_H
33

4-
#define LABEL_IPV4_EXPLICIT_NULL 0 /* RFC3032 */
5-
#define LABEL_ROUTER_ALERT_LABEL 1 /* RFC3032 */
6-
#define LABEL_IPV6_EXPLICIT_NULL 2 /* RFC3032 */
7-
#define LABEL_IMPLICIT_NULL 3 /* RFC3032 */
8-
#define LABEL_ENTROPY_INDICATOR 7 /* RFC6790 */
9-
#define LABEL_GAL 13 /* RFC5586 */
10-
#define LABEL_OAM_ALERT 14 /* RFC3429 */
11-
#define LABEL_EXTENSION 15 /* RFC7274 */
12-
13-
144
struct mpls_shim_hdr {
155
__be32 label_stack_entry;
166
};

0 commit comments

Comments
 (0)