Skip to content

Commit

Permalink
New MplsoverUdp destination port
Browse files Browse the repository at this point in the history
Start accepting the new mplsover udp destination ports
allotted by IANA. We continue to accept the old and new
destination ports and continue to use range of source ports

closes-bug: #1420900

Change-Id: I9bff6fdafbe7e242e0a7aef582a856777879cc17
  • Loading branch information
divakardhar committed May 5, 2015
1 parent e937aa9 commit 3464080
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dp-core/vr_proto_ip.c
Expand Up @@ -237,7 +237,7 @@ vr_udp_input(struct vrouter *router, struct vr_packet *pkt,
return 0;
}

if (ntohs(udph->udp_dport) == VR_MPLS_OVER_UDP_DST_PORT) {
if (vr_mpls_udp_port(ntohs(udph->udp_dport))) {
encap_type = PKT_ENCAP_MPLS;
} else if (ntohs(udph->udp_dport) == VR_VXLAN_UDP_DST_PORT) {
encap_type = PKT_ENCAP_VXLAN;
Expand Down
20 changes: 16 additions & 4 deletions include/vr_mpls.h
Expand Up @@ -12,10 +12,12 @@
#define VR_MAX_LABELS 5120
#define VR_MPLS_STACK_BIT (0x1 << 8)

#define VR_MPLS_OVER_UDP_DST_PORT 51234
#define VR_MPLS_OVER_UDP_SRC_PORT 51000
#define VR_MUDP_PORT_RANGE_START 49152
#define VR_MUDP_PORT_RANGE_END 65535
#define VR_MPLS_OVER_UDP_OLD_DST_PORT 51234
#define VR_MPLS_OVER_UDP_NEW_DST_PORT 6635
#define VR_MPLS_OVER_UDP_DST_PORT VR_MPLS_OVER_UDP_OLD_DST_PORT
#define VR_MPLS_OVER_UDP_SRC_PORT 51000
#define VR_MUDP_PORT_RANGE_START 49152
#define VR_MUDP_PORT_RANGE_END 65535

#define VR_VXLAN_UDP_DST_PORT 4789
#define VR_VXLAN_UDP_SRC_PORT 52000
Expand All @@ -35,6 +37,16 @@ extern int vr_mpls_input(struct vrouter *, struct vr_packet *,
struct vr_forwarding_md *);


static inline bool
vr_mpls_udp_port(unsigned short port)
{
if ((port == VR_MPLS_OVER_UDP_OLD_DST_PORT) ||
(port == VR_MPLS_OVER_UDP_NEW_DST_PORT))
return true;

return false;
}


static inline bool
vr_mpls_is_label_mcast(unsigned int lbl)
Expand Down
4 changes: 2 additions & 2 deletions linux/vrouter_mod.c
Expand Up @@ -1032,7 +1032,7 @@ lh_pull_inner_headers_fast_udp(struct vr_packet *pkt, int
udph = (struct vr_udp *) pkt_data(pkt);
}

if (ntohs(udph->udp_dport) == VR_MPLS_OVER_UDP_DST_PORT) {
if (vr_mpls_udp_port(ntohs(udph->udp_dport))) {

*encap_type = PKT_ENCAP_MPLS;
/* Take into consideration, the MPLS header and 4 bytes of
Expand Down Expand Up @@ -1730,7 +1730,7 @@ lh_pull_inner_headers(struct vr_packet *pkt,
if (ip_proto == VR_IP_PROTO_UDP) {
udph = (struct udphdr *)(skb->head + pkt->vp_data);
udph_cksum = udph->check;
if (ntohs(udph->dest) != VR_MPLS_OVER_UDP_DST_PORT) {
if (!vr_mpls_udp_port(ntohs(udph->dest))) {
/*
* we assumed earlier that the packet is mpls. now correct the
* assumption
Expand Down

0 comments on commit 3464080

Please sign in to comment.