BGP non root user port issue fix.
Change-Id: Ia2de9425807898f4e1e8c04f81475f77b5320c93
diff --git a/protocols/bgp/ctl/pom.xml b/protocols/bgp/ctl/pom.xml
index 2c0fa43..dabdd71 100755
--- a/protocols/bgp/ctl/pom.xml
+++ b/protocols/bgp/ctl/pom.xml
@@ -47,6 +47,11 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-common</artifactId>
+ <version>4.0.36.Final</version>
+ </dependency>
</dependencies>
<build>
diff --git a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpConfig.java b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpConfig.java
index bbeea48..a0bac3e 100755
--- a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpConfig.java
+++ b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpConfig.java
@@ -205,7 +205,7 @@
lspeer.setSelfInnitConnection(true);
if (lspeer.connectPeer() == null) {
- connectPeer = new BgpConnectPeerImpl(bgpController, routerid, Controller.getBgpPortNum());
+ connectPeer = new BgpConnectPeerImpl(bgpController, routerid, Controller.BGP_PORT_NUM);
lspeer.setConnectPeer(connectPeer);
connectPeer.connectPeer();
}
diff --git a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpPeerImpl.java b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpPeerImpl.java
index 3d14465..6f992f4 100644
--- a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpPeerImpl.java
+++ b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/BgpPeerImpl.java
@@ -159,8 +159,9 @@
* Send flow specification update message to peer.
*
* @param operType operation type
+ * @param routeKey flow rule key
* @param flowSpec flow specification details
- * @param wideCommunity for route policy
+ * @param wideCommunity for route policy
*/
public final void sendFlowSpecUpdateMessageToPeer(FlowSpecOperation operType, BgpFlowSpecRouteKey routeKey,
BgpFlowSpecNlri flowSpec, WideCommunity wideCommunity) {
diff --git a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
index 32f03f9..72f803d 100755
--- a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
+++ b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
@@ -16,7 +16,7 @@
package org.onosproject.bgp.controller.impl;
import static org.onlab.util.Tools.groupedThreads;
-
+import io.netty.util.internal.PlatformDependent;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.InetSocketAddress;
@@ -53,9 +53,11 @@
public Channel serverChannel;
// Configuration options
- private static final short BGP_PORT_NUM = 179;
+ protected static final short BGP_PORT_NUM = 179;
+ private static final short BGP_PRIVILEGED_PORT = 1790; // server port used for non root users in linux
private static final short PORT_NUM_ZERO = 0;
private static boolean isPortNumSet = false;
+ private static short portNumber = BGP_PORT_NUM;
private final int workerThreads = 16;
private final int peerWorkerThreads = 16;
@@ -219,6 +221,11 @@
*/
public void start() {
log.info("Started");
+ if (!PlatformDependent.isWindows() && !PlatformDependent.isRoot()) {
+ portNumber = BGP_PRIVILEGED_PORT;
+ } else {
+ portNumber = BGP_PORT_NUM;
+ }
this.init();
this.run();
}
@@ -242,7 +249,8 @@
if (isPortNumSet) {
return PORT_NUM_ZERO;
}
- return BGP_PORT_NUM;
+
+ return portNumber;
}
/**