Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 SetError(EHOSTUNREACH); | 34 SetError(EHOSTUNREACH); |
| 35 return SOCKET_ERROR; | 35 return SOCKET_ERROR; |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 return AsyncSocketAdapter::Connect(addr); | 38 return AsyncSocketAdapter::Connect(addr); |
| 39 } | 39 } |
| 40 int Send(const void* pv, size_t cb) override { | 40 int Send(const void* pv, size_t cb) override { |
| 41 return SendTo(pv, cb, GetRemoteAddress()); | 41 return SendTo(pv, cb, GetRemoteAddress()); |
| 42 } | 42 } |
| 43 int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override { | 43 int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override { |
| 44 if (type_ == SOCK_DGRAM) { | 44 RTC_DCHECK(type_ == SOCK_DGRAM || type_ == SOCK_STREAM); |
| 45 if (!server_->Check(FP_UDP, GetLocalAddress(), addr)) { | 45 FirewallProtocol protocol = (type_ == SOCK_DGRAM) ? FP_UDP : FP_TCP; |
|
honghaiz3
2016/10/03 21:28:33
This is needed so that TCP traffic can be filtered
| |
| 46 LOG(LS_VERBOSE) << "FirewallSocket outbound UDP packet from " | 46 if (!server_->Check(protocol, GetLocalAddress(), addr)) { |
| 47 << GetLocalAddress().ToSensitiveString() << " to " | 47 LOG(LS_VERBOSE) << "FirewallSocket outbound packet with type " << type_ |
| 48 << addr.ToSensitiveString() << " dropped"; | 48 << " from " << GetLocalAddress().ToSensitiveString() |
| 49 return static_cast<int>(cb); | 49 << " to " << addr.ToSensitiveString() << " dropped"; |
| 50 } | 50 return static_cast<int>(cb); |
| 51 } | 51 } |
| 52 return AsyncSocketAdapter::SendTo(pv, cb, addr); | 52 return AsyncSocketAdapter::SendTo(pv, cb, addr); |
| 53 } | 53 } |
| 54 int Recv(void* pv, size_t cb, int64_t* timestamp) override { | 54 int Recv(void* pv, size_t cb, int64_t* timestamp) override { |
| 55 SocketAddress addr; | 55 SocketAddress addr; |
| 56 return RecvFrom(pv, cb, &addr, timestamp); | 56 return RecvFrom(pv, cb, &addr, timestamp); |
| 57 } | 57 } |
| 58 int RecvFrom(void* pv, | 58 int RecvFrom(void* pv, |
| 59 size_t cb, | 59 size_t cb, |
| 60 SocketAddress* paddr, | 60 SocketAddress* paddr, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 244 |
| 245 void FirewallManager::ClearRules() { | 245 void FirewallManager::ClearRules() { |
| 246 CritScope scope(&crit_); | 246 CritScope scope(&crit_); |
| 247 for (std::vector<FirewallSocketServer*>::const_iterator it = | 247 for (std::vector<FirewallSocketServer*>::const_iterator it = |
| 248 servers_.begin(); it != servers_.end(); ++it) { | 248 servers_.begin(); it != servers_.end(); ++it) { |
| 249 (*it)->ClearRules(); | 249 (*it)->ClearRules(); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace rtc | 253 } // namespace rtc |
| OLD | NEW |