summaryrefslogtreecommitdiff
path: root/src/networking.c
Commit message (Collapse)AuthorAgeFilesLines
* Security: Cross Protocol Scripting protection.antirez2016-08-031-2/+24
| | | | | | | | | | | | | | This is an attempt at mitigating problems due to cross protocol scripting, an attack targeting services using line oriented protocols like Redis that can accept HTTP requests as valid protocol, by discarding the invalid parts and accepting the payloads sent, for example, via a POST request. For this to be effective, when we detect POST and Host: and terminate the connection asynchronously, the networking code was modified in order to never process further input. It was later verified that in a pipelined request containing a POST command, the successive commands are not executed.
* Ability of slave to announce arbitrary ip/port to master.antirez2016-07-271-0/+1
| | | | | | | | | This feature is useful, especially in deployments using Sentinel in order to setup Redis HA, where the slave is executed with NAT or port forwarding, so that the auto-detected port/ip addresses, as listed in the "INFO replication" output of the master, or as provided by the "ROLE" command, don't match the real addresses at which the slave is reachable for connections.
* CLIENT error message was out of dateoranagra2016-05-231-1/+1
|
* Modules: first preview 31 March 2016.antirez2016-05-101-1/+1
|
* networking.c minor optimizationOran Agra2016-04-251-6/+5
|
* additional fix to issue #2948Oran Agra2016-04-251-0/+3
|
* addReplyHumanLongDouble() API added.antirez2016-02-181-0/+9
| | | | | Send a long double or double as a bulk reply, in a human friendly format.
* Removes an extra space in protected mode messageItamar Haber2016-01-201-1/+1
|
* Another typo in protected mode error message.antirez2016-01-071-1/+1
|
* Fix protected mode error message typo.antirez2016-01-071-1/+1
|
* New security feature: Redis protected mode.antirez2016-01-071-3/+45
| | | | | | | | | | | | | | | | | | | | | An exposed Redis instance on the internet can be cause of serious issues. Since Redis, by default, binds to all the interfaces, it is easy to forget an instance without any protection layer, for error. Protected mode try to address this feature in a soft way, providing a layer of protection, but giving clues to Redis users about why the server is not accepting connections. When protected mode is enabeld (the default), and if there are no minumum hints about the fact the server is properly configured (no "bind" directive is used in order to restrict the server to certain interfaces, nor a password is set), clients connecting from external intefaces are refused with an error explaining what to do in order to fix the issue. Clients connecting from the IPv4 and IPv6 lookback interfaces are still accepted normally, similarly Unix domain socket connections are not restricted in any way.
* MIGRATE: fix replies processing and argument rewriting.antirez2015-12-111-3/+16
| | | | | | | We need to process replies after errors in order to delete keys successfully transferred. Also argument rewriting was fixed since it was broken in several ways. Now a fresh argument vector is created and set if we are acknowledged of at least one key.
* Pipelined multiple keys MIGRATE.antirez2015-12-111-1/+1
|
* unlinkClient(): clear flags according to ops performed.antirez2015-12-091-0/+2
|
* Fix typo in prepareClientToWrite() comment.antirez2015-11-271-1/+1
|
* Best effort flush of slave buffers before SHUTDOWN.antirez2015-11-091-1/+3
|
* Use clientHasPendingReplies() in flushSlavesOutputBuffers()antirez2015-11-091-1/+1
| | | | | | | | The old version only flushed data to slaves if there were strings pending in the client->reply list. Now also static buffers are flushed. Does not help to free memory (which is the only use we have right now in the fuction), but is more correct conceptually, and may be used in other contexts.
* CLIENT REPLY command implemented: ON, OFF and SKIP modes.antirez2015-10-211-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes it can be useful for clients to completely disable replies from the Redis server. For example when the client sends fire and forget commands or performs a mass loading of data, or in caching contexts where new data is streamed constantly. In such contexts to use server time and bandwidth in order to send back replies to clients, which are going to be ignored, is a shame. Multiple mechanisms are possible to implement such a feature. For example it could be a feature of MULTI/EXEC, or a command prefix such as "NOREPLY SADD myset foo", or a different mechanism that allows to switch on/off requests using the CLIENT command. The MULTI/EXEC approach has the problem that transactions are not strictly part of the no-reply semantics, and if we want to insert a lot of data in a bulk way, creating a huge MULTI/EXEC transaction in the server memory is bad. The prefix is the best in this specific use case since it does not allow desynchronizations, and is pretty clear semantically. However Redis internals and client libraries are not prepared to handle this currently. So the implementation uses the CLIENT command, providing a new REPLY subcommand with three options: CLIENT REPLY OFF disables the replies, and does not reply itself. CLIENT REPLY ON re-enables the replies, replying +OK. CLIENT REPLY SKIP only discards the reply of the next command, and like OFF does not reply anything itself. The reason to add the SKIP command is that it allows to have an easy way to send conceptually "single" commands that don't need a reply as the sum of two pipelined commands: CLIENT REPLY SKIP SET key value Note that CLIENT REPLY ON replies with +OK so it should be used when sending multiple commands that don't need a reply. However since it replies with +OK the client can check that the connection is still active and all the previous commands were received. This is currently just into Redis "unstable" so the proposal can be modified or abandoned based on users inputs.
* Lazyfree: Convert Sets to use plains SDS (several commits squashed).antirez2015-10-011-2/+2
|
* Lazyfree: client output buffers no longer use Redis Objects.antirez2015-10-011-95/+70
|
* Call writeToClient() directly instead of the write handler.fasterioantirez2015-09-301-1/+1
|
* Fix processEventsWhileBlocked() to handle PENDING_WRITE clients.antirez2015-09-301-2/+6
| | | | | | After the introduction of the list with clients with pending writes, to process clients incrementally outside of the event loop we also need to process the pending writes list.
* Refactoring: unlinkClient() added to lower freeClient() complexity.antirez2015-09-301-29/+45
|
* Refactoring: new function to test if client has pending output.antirez2015-09-301-6/+14
|
* Reverse list of clients with pending writes.antirez2015-09-301-1/+1
| | | | | May potentially improve locality... not exactly clear if this makes a difference or not. But for sure is harmless.
* writeToClient(): don't remove write handler if not needed.antirez2015-09-301-4/+4
|
* handleClientsWithPendingWrites(): detect dead clients.antirez2015-09-301-7/+17
|
* Move handleClientsWithPendingWrites() in networking.c.antirez2015-09-301-0/+28
|
* Avoid installing the client write handler when possible.antirez2015-09-301-7/+15
|
* flushSlavesOutputBuffers(): details clarified via comments.antirez2015-08-061-0/+6
| | | | | | | | | | Talking with @oranagra we had to reason a little bit to understand if this function could ever flush the output buffers of the wrong slaves, having online state but actually not being ready to receive writes before the first ACK is received from them (this happens with diskless replication). Next time we'll just read this comment.
* Replication: add REPLCONF CAPA EOF support.slaves_capaantirez2015-08-061-0/+1
| | | | | | | | | | | | | | | | | Add the concept of slaves capabilities to Redis, the slave now presents to the Redis master with a set of capabilities in the form: REPLCONF capa SOMECAPA capa OTHERCAPA ... This has the effect of setting slave->slave_capa with the corresponding SLAVE_CAPA macros that the master can test later to understand if it the slave will understand certain formats and protocols of the replication process. This makes it much simpler to introduce new replication capabilities in the future in a way that don't break old slaves or masters. This patch was designed and implemented together with Oran Agra (@oranagra).
* Support for CLIENT KILL TYPE MASTER.antirez2015-07-281-3/+1
|
* CLIENT_MASTER introduced.antirez2015-07-281-2/+9
|
* replicationHandleMasterDisconnection() belongs to replication.c.antirez2015-07-281-14/+0
|
* RDMF: More consistent define names.antirez2015-07-271-127/+127
|
* RDMF: REDIS_OK REDIS_ERR -> C_OK C_ERR.antirez2015-07-261-39/+39
|
* RDMF: redisAssert -> serverAssert.antirez2015-07-261-14/+14
|
* RDMF: OBJ_ macros for object related stuff.antirez2015-07-261-13/+13
|
* RDMF: use client instead of redisClient, like Disque.antirez2015-07-261-59/+59
|
* RDMF: redisLog -> serverLog.antirez2015-07-261-13/+13
|
* RDMF (Redis/Disque merge friendlyness) refactoring WIP 1.antirez2015-07-261-1/+1
|
* SDS: changes to unify Redis SDS with antirez/sds repo.antirez2015-07-251-0/+7
|
* sds size classes - memory optimizationOran Agra2015-07-141-20/+13
|
* Geo: GEOADD implementation improved, replication fixedantirez2015-06-231-0/+10
| | | | | | | 1. We no longer use a fake client but just rewriting. 2. We group all the inserts into a single ZADD dispatch (big speed win). 3. As a side effect of the correct implementation, replication works. 4. The return value of the command is now correct.
* protocol error log should be seen debug/verbose levelJungtaek Lim2015-05-121-1/+1
|
* Fix Redis server crash when Lua command exceeds client output bufferYossi Gottlieb2015-04-261-1/+1
| | | | limit.
* Net: improve prepareClientToWrite() error handling and comments.antirez2015-04-011-7/+33
| | | | | | | | | | | | | When we fail to setup the write handler it does not make sense to take the client around, it is missing writes: whatever is a client or a slave anyway the connection should terminated ASAP. Moreover what the function does exactly with its return value, and in which case the write handler is installed on the socket, was not clear, so the functions comment are improved to make the goals of the function more obvious. Also related to #2485.
* fixes to diskless replication.Oran Agra2015-03-311-1/+1
| | | | | master was closing the connection if the RDB transfer took long time. and also sent PINGs to the slave before it got the initial ACK, in which case the slave wouldn't be able to find the EOF marker.
* Ensure array index is in range in addReplyLongLongWithPrefix().antirez2015-03-301-2/+2
| | | | | Change done in order to remove a warning and improve code robustness. No actual bug here.
* Net: processUnblockedClients() and clientsArePaused() minor changes.antirez2015-03-211-1/+6
| | | | | | | | 1. No need to set btype in processUnblockedClients(), since clients flagged REDIS_UNBLOCKED should have it already cleared. 2. When putting clients in the unblocked clients list, clientsArePaused() should flag them with REDIS_UNBLOCKED. Not strictly needed with the current code but is more coherent.