Commit 05816965 authored by nanamicat's avatar nanamicat

fix

parent 92bbbbbd
...@@ -21,10 +21,10 @@ void inbound(int raw, int tun) { ...@@ -21,10 +21,10 @@ void inbound(int raw, int tun) {
while ((nread = recvfrom(raw, buf, sizeof(buf), 0, (sockaddr *) &addr, &addrlen)) >= 0) { while ((nread = recvfrom(raw, buf, sizeof(buf), 0, (sockaddr *) &addr, &addrlen)) >= 0) {
std::cout << nread << std::endl; std::cout << nread << std::endl;
if (write(tun, buf, nread) < 0) { if (write(tun, buf, nread) < 0) {
perror("outbound write"); perror("inbound write");
} }
} }
perror("outbound read"); perror("inbound read");
} }
// tun -> internet // tun -> internet
...@@ -35,10 +35,10 @@ void outbound(int raw, int tun) { ...@@ -35,10 +35,10 @@ void outbound(int raw, int tun) {
size_t nread; size_t nread;
while ((nread = read(tun, buf, sizeof(buf))) >= 0) { while ((nread = read(tun, buf, sizeof(buf))) >= 0) {
if (sendto(raw, buf, nread, 0, (sockaddr *) &addr, sizeof(addr)) < 0) { if (sendto(raw, buf, nread, 0, (sockaddr *) &addr, sizeof(addr)) < 0) {
perror("inbound write"); perror("outbound write");
} }
} }
perror("inbound read"); perror("outbound read");
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment