Skip to content

Commit

Permalink
mpls: export mpls functions for use by mpls iptunnels
Browse files Browse the repository at this point in the history
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
roopa-prabhu authored and davem330 committed Jul 21, 2015
1 parent 74a0f2f commit face018
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 8 additions & 3 deletions net/mpls/af_mpls.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,26 @@ static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev)
return rcu_dereference_rtnl(dev->mpls_ptr);
}

static bool mpls_output_possible(const struct net_device *dev)
bool mpls_output_possible(const struct net_device *dev)
{
return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev);
}
EXPORT_SYMBOL_GPL(mpls_output_possible);

static unsigned int mpls_rt_header_size(const struct mpls_route *rt)
{
/* The size of the layer 2.5 labels to be added for this route */
return rt->rt_labels * sizeof(struct mpls_shim_hdr);
}

static unsigned int mpls_dev_mtu(const struct net_device *dev)
unsigned int mpls_dev_mtu(const struct net_device *dev)
{
/* The amount of data the layer 2 frame can hold */
return dev->mtu;
}
EXPORT_SYMBOL_GPL(mpls_dev_mtu);

static bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
{
if (skb->len <= mtu)
return false;
Expand All @@ -85,6 +87,7 @@ static bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)

return true;
}
EXPORT_SYMBOL_GPL(mpls_pkt_too_big);

static bool mpls_egress(struct mpls_route *rt, struct sk_buff *skb,
struct mpls_entry_decoded dec)
Expand Down Expand Up @@ -626,6 +629,7 @@ int nla_put_labels(struct sk_buff *skb, int attrtype,

return 0;
}
EXPORT_SYMBOL_GPL(nla_put_labels);

int nla_get_labels(const struct nlattr *nla,
u32 max_labels, u32 *labels, u32 label[])
Expand Down Expand Up @@ -671,6 +675,7 @@ int nla_get_labels(const struct nlattr *nla,
*labels = nla_labels;
return 0;
}
EXPORT_SYMBOL_GPL(nla_get_labels);

static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh,
struct mpls_route_config *cfg)
Expand Down
9 changes: 7 additions & 2 deletions net/mpls/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ static inline struct mpls_entry_decoded mpls_entry_decode(struct mpls_shim_hdr *
return result;
}

int nla_put_labels(struct sk_buff *skb, int attrtype, u8 labels, const u32 label[]);
int nla_get_labels(const struct nlattr *nla, u32 max_labels, u32 *labels, u32 label[]);
int nla_put_labels(struct sk_buff *skb, int attrtype, u8 labels,
const u32 label[]);
int nla_get_labels(const struct nlattr *nla, u32 max_labels, u32 *labels,
u32 label[]);
bool mpls_output_possible(const struct net_device *dev);
unsigned int mpls_dev_mtu(const struct net_device *dev);
bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu);

#endif /* MPLS_INTERNAL_H */

0 comments on commit face018

Please sign in to comment.