Skip to content

Commit 92eba52

Browse files
committed
Spell check fixes;
Refactored the firewall rule explanation, and made it include the fix from the GitHub wiki.
1 parent db24b8c commit 92eba52

File tree

14 files changed

+68
-58
lines changed

14 files changed

+68
-58
lines changed

data/roscon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</option>
2222
<option name="conTime">
2323
<long_name>--cTimeout</long_name>
24-
<description>Time in seconds to wait for the connection to be estabilished. If "--timeout" is specified, its value will be used when this option is not specified.
24+
<description>Time in seconds to wait for the connection to be established. If "--timeout" is specified, its value will be used when this option is not specified.
2525
Defaults to PHP's default_socket_timeout ini option.</description>
2626
<action>StoreInt</action>
2727
</option>

scripts/roscon.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ REM 4. Whatever %PHP_PEAR_PHP_BIN% points to.
77
REM
88
REM Once a binary is found, a file is looked for that has the same name as
99
REM this batch file.
10-
REM Prefered extensions are ".php" and then no extension.
10+
REM Preferred extensions are ".php" and then no extension.
1111
goto SET_BIN
1212
:PHP_ERR
1313
echo PHP interpreter not found. Please set the %%PHPBIN%% or %%PHP_PEAR_PHP_BIN%% environment variable to one, or add one to your %%PATH%%.

scripts/roscon.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
// 1. The PHP_PEAR_DATA_DIR environment variable, if available
130130
// 2. The data folder at "mypear" (filled at install time by Pyrus/PEAR)
131131
// 3. The source layout's data folder (also used when running in PHAR).
132-
// NOTE: using dirname(__FILE__) instead of __DIR__ to elegantly support PHAR.
133132
$dataDir = (false != ($pearDataDir = getenv('PHP_PEAR_DATA_DIR')))
134133
? realpath($pearDataDir . '/@PACKAGE_CHANNEL@/@PACKAGE_NAME@')
135134
: false;
@@ -301,13 +300,24 @@
301300
to allow you to make outgoing connections to the ip:port you've set the API
302301
service on.
303302
304-
6. The router has a filter/mangle/nat rule that overrides the settings at
305-
"/ip service".
306-
This is a very rare scenario, but if you want to be sure, try to disable all
307-
rules that may cause such a thing, or (if you can afford it) set up a fresh
308-
RouterOS in place of the existing one, and see if you can connect to it
309-
instead. If you still can't connect, such a rule is certainly not the (only)
310-
reason.
303+
6. The router has a firewall filter/mangle/nat rule that overrides the settings
304+
at "/ip service".
305+
Usually, those are rules in the "input" chain.
306+
Theoretically, rules in the "prerouting" and/or "output" chains can also
307+
have such an effect.
308+
By default, RouterBOARD devices have a filter rule in the "input" chain that
309+
drops any incoming connections to the router from its WAN interface, so if
310+
your web server is not in the LAN, the connection may be dropped because of
311+
that.
312+
If that's the case, either disable that rule, or explicitly whitelist the
313+
API port. You can whitelist the API port on all interfaces by issuing the
314+
following command from a terminal:
315+
```
316+
/ip firewall filter
317+
add place-before=[find where chain="input" && action="drop"] \
318+
chain="input" action="accept" \
319+
dst-port=[/ip service get "api" "port"]
320+
```
311321
312322
HEREDOC
313323
);

src/PEAR2/Net/RouterOS/Client.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function __construct(
178178
* the class is invoked and its returned value is returned by this function.
179179
*
180180
* @param mixed $arg Value can be either a {@link Request} to send, which
181-
* would be sent asynchoniously if it has a tag, and synchroniously if
181+
* would be sent asynchronously if it has a tag, and synchronously if
182182
* not, a number to loop with or NULL to complete all pending requests.
183183
* Any other value is converted to string and treated as the tag of a
184184
* request to complete.
@@ -205,7 +205,7 @@ public function __invoke($arg = null)
205205
* @param string $username The RouterOS username.
206206
* @param string $password The RouterOS password.
207207
* @param int|null $timeout The time to wait for each response. NULL
208-
* waits indefinetly.
208+
* waits indefinitely.
209209
*
210210
* @return bool TRUE on success, FALSE on failure.
211211
*/
@@ -258,7 +258,7 @@ public static function login(
258258
* @param string $password The RouterOS password. Potentially parsed
259259
* already by iconv.
260260
* @param int|null $timeout The time to wait for each response. NULL
261-
* waits indefinetly.
261+
* waits indefinitely.
262262
*
263263
* @return bool TRUE on success, FALSE on failure.
264264
*/
@@ -393,7 +393,7 @@ public function sendAsync(Request $request, $callback = null)
393393
* pending request and/or has responses that are not yet extracted.
394394
*
395395
* @param string $tag The tag of the request to look for.
396-
* @param int $filter One of the FILTER_* consntants. Limits the search
396+
* @param int $filter One of the FILTER_* constants. Limits the search
397397
* to the specified places.
398398
*
399399
* @return bool TRUE if the request is active, FALSE otherwise.
@@ -593,7 +593,7 @@ public function getPendingRequestsCount()
593593
* Cancels a request.
594594
*
595595
* Cancels an active request. Using this function in favor of a plain call
596-
* to the "/cancel" command is highly reccomended, as it also updates the
596+
* to the "/cancel" command is highly recommended, as it also updates the
597597
* counter of pending requests properly. Note that canceling a request also
598598
* removes any responses for it that were not previously extracted with
599599
* {@link static::extractNewResponses()}.
@@ -775,8 +775,8 @@ protected function send(Request $request)
775775
* Dispatches the next response in queue, i.e. it executes the associated
776776
* callback if there is one, or places the response in the response buffer.
777777
*
778-
* @param int $sTimeout If a response is not immediatly available, wait
779-
* this many seconds. If NULL, wait indefinetly.
778+
* @param int $sTimeout If a response is not immediately available, wait
779+
* this many seconds. If NULL, wait indefinitely.
780780
* @param int $usTimeout Microseconds to add to the waiting time.
781781
*
782782
* @throws SocketException When there's no response within the time limit.

src/PEAR2/Net/RouterOS/Communicator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* A RouterOS communicator.
3030
*
3131
* Implementation of the RouterOS API protocol. Unlike the other classes in this
32-
* package, this class doesn't provide any conviniences beyond the low level
32+
* package, this class doesn't provide any conveniences beyond the low level
3333
* implementation details (automatic word length encoding/decoding, charset
3434
* translation and data integrity), and because of that, its direct usage is
3535
* strongly discouraged.
@@ -170,7 +170,7 @@ public function __construct(
170170
* next word as a string.
171171
*
172172
* @return int|string If a string is provided, returns the number of bytes
173-
* sent, otherwise retuns the next word as a string.
173+
* sent, otherwise returns the next word as a string.
174174
*/
175175
public function __invoke($string = null)
176176
{
@@ -310,7 +310,7 @@ public static function seekableStreamLength($stream)
310310
* used for all future words. When sending, {@link self::CHARSET_LOCAL} is
311311
* converted to {@link self::CHARSET_REMOTE}, and when receiving,
312312
* {@link self::CHARSET_REMOTE} is converted to {@link self::CHARSET_LOCAL}.
313-
* Setting NULL to either charset will disable charset convertion, and data
313+
* Setting NULL to either charset will disable charset conversion, and data
314314
* will be both sent and received "as is".
315315
*
316316
* @param mixed $charset The charset to set. If $charsetType is
@@ -478,7 +478,7 @@ protected static function verifyLengthSupport($length)
478478
}
479479

480480
/**
481-
* Encodes the length as requred by the RouterOS API.
481+
* Encodes the length as required by the RouterOS API.
482482
*
483483
* @param int $length The length to encode.
484484
*
@@ -596,9 +596,9 @@ public function getNextWordAsStream()
596596
}
597597

598598
/**
599-
* Decodes the lenght of the incoming message.
599+
* Decodes the length of the incoming message.
600600
*
601-
* Decodes the lenght of the incoming message, as specified by the RouterOS
601+
* Decodes the length of the incoming message, as specified by the RouterOS
602602
* API.
603603
*
604604
* @param T\Stream $trans The transmitter from which to decode the length of
@@ -618,9 +618,9 @@ public static function decodeLength(T\Stream $trans)
618618
}
619619

620620
/**
621-
* Decodes the lenght of the incoming message.
621+
* Decodes the length of the incoming message.
622622
*
623-
* Decodes the lenght of the incoming message, as specified by the RouterOS
623+
* Decodes the length of the incoming message, as specified by the RouterOS
624624
* API.
625625
*
626626
* Difference with the non private function is that this one doesn't perform

src/PEAR2/Net/RouterOS/Message.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use IteratorAggregate;
3232

3333
/**
34-
* Requred for IteratorAggregate::getIterator() to work properly with foreach.
34+
* Required for IteratorAggregate::getIterator() to work properly with foreach.
3535
*/
3636
use ArrayObject;
3737

@@ -49,7 +49,7 @@ abstract class Message implements IteratorAggregate, Countable
4949

5050
/**
5151
* @var array An array with message attributes. Each array key is the the
52-
* name of an attribute, and the correspding array value is the value
52+
* name of an attribute, and the corresponding array value is the value
5353
* for that attribute.
5454
*/
5555
protected $attributes = array();
@@ -205,7 +205,7 @@ public function count($mode = COUNT_NORMAL)
205205
* seekable stream.
206206
* Setting the value to NULL removes an argument of this name.
207207
* If a seekable stream is provided, it is sent from its current
208-
* posistion to its end, and the pointer is seeked back to its current
208+
* position to its end, and the pointer is seeked back to its current
209209
* position after sending.
210210
* Non seekable streams, as well as all other types, are casted to a
211211
* string.

src/PEAR2/Net/RouterOS/NotSupportedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NotSupportedException extends E implements Exception
4141
const CODE_CONTROL_BYTE = 1601;
4242

4343
/**
44-
* @var mixed The unsuppported value.
44+
* @var mixed The unsupported value.
4545
*/
4646
private $_value;
4747

src/PEAR2/Net/RouterOS/Query.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Query
5858
const OP_LT = '<';
5959

6060
/**
61-
* Checks if the property is greather than a certain value.
61+
* Checks if the property is greater than a certain value.
6262
*/
6363
const OP_GT = '>';
6464

@@ -112,7 +112,7 @@ protected static function sanitizeOperator($operator)
112112
* @param string|resource|null $value Value of the property as a string
113113
* or seekable stream. Not required for existence tests.
114114
* If a seekable stream is provided, it is sent from its current
115-
* posistion to its end, and the pointer is seeked back to its current
115+
* position to its end, and the pointer is seeked back to its current
116116
* position after sending.
117117
* Non seekable streams, as well as all other types, are casted to a
118118
* string.
@@ -148,7 +148,7 @@ public function not()
148148
* @param string|resource|null $value Value of the property as a string
149149
* or seekable stream. Not required for existence tests.
150150
* If a seekable stream is provided, it is sent from its current
151-
* posistion to its end, and the pointer is seeked back to its current
151+
* position to its end, and the pointer is seeked back to its current
152152
* position after sending.
153153
* Non seekable streams, as well as all other types, are casted to a
154154
* string.
@@ -170,7 +170,7 @@ public function orWhere($name, $value = null, $operator = self::OP_EX)
170170
* @param string|resource|null $value Value of the property as a string
171171
* or seekable stream. Not required for existence tests.
172172
* If a seekable stream is provided, it is sent from its current
173-
* posistion to its end, and the pointer is seeked back to its current
173+
* position to its end, and the pointer is seeked back to its current
174174
* position after sending.
175175
* Non seekable streams, as well as all other types, are casted to a
176176
* string.
@@ -246,7 +246,7 @@ private function _send(Communicator $com)
246246
* @param string|resource|null $value Value of the property as a string
247247
* or seekable stream. Not required for existence tests.
248248
* If a seekable stream is provided, it is sent from its current
249-
* posistion to its end, and the pointer is seeked back to its current
249+
* position to its end, and the pointer is seeked back to its current
250250
* position after sending.
251251
* Non seekable streams, as well as all other types, are casted to a
252252
* string.

src/PEAR2/Net/RouterOS/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function isTaglessModeOwner()
118118
/**
119119
* Sets the "tagless mode" setting.
120120
*
121-
* While in tagless mode, this instance will claim owhership of any
121+
* While in tagless mode, this instance will claim ownership of any
122122
* responses without a tag. While not in this mode, any requests without a
123123
* tag will be given to all instances.
124124
*

src/PEAR2/Net/RouterOS/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function setTag($tag)
222222
* seekable stream.
223223
* Setting the value to NULL removes an argument of this name.
224224
* If a seekable stream is provided, it is sent from its current
225-
* posistion to its end, and the pointer is seeked back to its current
225+
* position to its end, and the pointer is seeked back to its current
226226
* position after sending.
227227
* Non seekable streams, as well as all other types, are casted to a
228228
* string.

0 commit comments

Comments
 (0)