Committed by
ShashikanthVH-Huawei
BGP non root user port issue fix.
Change-Id: Ia2de9425807898f4e1e8c04f81475f77b5320c93
Showing
4 changed files
with
19 additions
and
5 deletions
... | @@ -47,6 +47,11 @@ | ... | @@ -47,6 +47,11 @@ |
47 | <groupId>org.osgi</groupId> | 47 | <groupId>org.osgi</groupId> |
48 | <artifactId>org.osgi.compendium</artifactId> | 48 | <artifactId>org.osgi.compendium</artifactId> |
49 | </dependency> | 49 | </dependency> |
50 | + <dependency> | ||
51 | + <groupId>io.netty</groupId> | ||
52 | + <artifactId>netty-common</artifactId> | ||
53 | + <version>4.0.36.Final</version> | ||
54 | + </dependency> | ||
50 | </dependencies> | 55 | </dependencies> |
51 | 56 | ||
52 | <build> | 57 | <build> | ... | ... |
... | @@ -205,7 +205,7 @@ public class BgpConfig implements BgpCfg { | ... | @@ -205,7 +205,7 @@ public class BgpConfig implements BgpCfg { |
205 | lspeer.setSelfInnitConnection(true); | 205 | lspeer.setSelfInnitConnection(true); |
206 | 206 | ||
207 | if (lspeer.connectPeer() == null) { | 207 | if (lspeer.connectPeer() == null) { |
208 | - connectPeer = new BgpConnectPeerImpl(bgpController, routerid, Controller.getBgpPortNum()); | 208 | + connectPeer = new BgpConnectPeerImpl(bgpController, routerid, Controller.BGP_PORT_NUM); |
209 | lspeer.setConnectPeer(connectPeer); | 209 | lspeer.setConnectPeer(connectPeer); |
210 | connectPeer.connectPeer(); | 210 | connectPeer.connectPeer(); |
211 | } | 211 | } | ... | ... |
... | @@ -159,8 +159,9 @@ public class BgpPeerImpl implements BgpPeer { | ... | @@ -159,8 +159,9 @@ public class BgpPeerImpl implements BgpPeer { |
159 | * Send flow specification update message to peer. | 159 | * Send flow specification update message to peer. |
160 | * | 160 | * |
161 | * @param operType operation type | 161 | * @param operType operation type |
162 | + * @param routeKey flow rule key | ||
162 | * @param flowSpec flow specification details | 163 | * @param flowSpec flow specification details |
163 | - * @param wideCommunity for route policy | 164 | + * @param wideCommunity for route policy |
164 | */ | 165 | */ |
165 | public final void sendFlowSpecUpdateMessageToPeer(FlowSpecOperation operType, BgpFlowSpecRouteKey routeKey, | 166 | public final void sendFlowSpecUpdateMessageToPeer(FlowSpecOperation operType, BgpFlowSpecRouteKey routeKey, |
166 | BgpFlowSpecNlri flowSpec, WideCommunity wideCommunity) { | 167 | BgpFlowSpecNlri flowSpec, WideCommunity wideCommunity) { | ... | ... |
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | package org.onosproject.bgp.controller.impl; | 16 | package org.onosproject.bgp.controller.impl; |
17 | 17 | ||
18 | import static org.onlab.util.Tools.groupedThreads; | 18 | import static org.onlab.util.Tools.groupedThreads; |
19 | - | 19 | +import io.netty.util.internal.PlatformDependent; |
20 | import java.lang.management.ManagementFactory; | 20 | import java.lang.management.ManagementFactory; |
21 | import java.lang.management.RuntimeMXBean; | 21 | import java.lang.management.RuntimeMXBean; |
22 | import java.net.InetSocketAddress; | 22 | import java.net.InetSocketAddress; |
... | @@ -53,9 +53,11 @@ public class Controller { | ... | @@ -53,9 +53,11 @@ public class Controller { |
53 | public Channel serverChannel; | 53 | public Channel serverChannel; |
54 | 54 | ||
55 | // Configuration options | 55 | // Configuration options |
56 | - private static final short BGP_PORT_NUM = 179; | 56 | + protected static final short BGP_PORT_NUM = 179; |
57 | + private static final short BGP_PRIVILEGED_PORT = 1790; // server port used for non root users in linux | ||
57 | private static final short PORT_NUM_ZERO = 0; | 58 | private static final short PORT_NUM_ZERO = 0; |
58 | private static boolean isPortNumSet = false; | 59 | private static boolean isPortNumSet = false; |
60 | + private static short portNumber = BGP_PORT_NUM; | ||
59 | private final int workerThreads = 16; | 61 | private final int workerThreads = 16; |
60 | private final int peerWorkerThreads = 16; | 62 | private final int peerWorkerThreads = 16; |
61 | 63 | ||
... | @@ -219,6 +221,11 @@ public class Controller { | ... | @@ -219,6 +221,11 @@ public class Controller { |
219 | */ | 221 | */ |
220 | public void start() { | 222 | public void start() { |
221 | log.info("Started"); | 223 | log.info("Started"); |
224 | + if (!PlatformDependent.isWindows() && !PlatformDependent.isRoot()) { | ||
225 | + portNumber = BGP_PRIVILEGED_PORT; | ||
226 | + } else { | ||
227 | + portNumber = BGP_PORT_NUM; | ||
228 | + } | ||
222 | this.init(); | 229 | this.init(); |
223 | this.run(); | 230 | this.run(); |
224 | } | 231 | } |
... | @@ -242,7 +249,8 @@ public class Controller { | ... | @@ -242,7 +249,8 @@ public class Controller { |
242 | if (isPortNumSet) { | 249 | if (isPortNumSet) { |
243 | return PORT_NUM_ZERO; | 250 | return PORT_NUM_ZERO; |
244 | } | 251 | } |
245 | - return BGP_PORT_NUM; | 252 | + |
253 | + return portNumber; | ||
246 | } | 254 | } |
247 | 255 | ||
248 | /** | 256 | /** | ... | ... |
-
Please register or login to post a comment