projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5fa29b1
)
nixio: More sockopts
author
Steven Barth
<steven@midlink.org>
Fri, 13 Mar 2009 12:10:33 +0000
(12:10 +0000)
committer
Steven Barth
<steven@midlink.org>
Fri, 13 Mar 2009 12:10:33 +0000
(12:10 +0000)
libs/nixio/src/sockopt.c
patch
|
blob
|
history
diff --git
a/libs/nixio/src/sockopt.c
b/libs/nixio/src/sockopt.c
index
5965eae
..
2d68d12
100644
(file)
--- a/
libs/nixio/src/sockopt.c
+++ b/
libs/nixio/src/sockopt.c
@@
-108,6
+108,8
@@
static int nixio__gso_timev(lua_State *L, int fd, int level, int opt, int set) {
return nixio__perror(L);
}
return nixio__perror(L);
}
+#ifdef SO_BINDTODEVICE
+
static int nixio__gso_b(lua_State *L, int fd, int level, int opt, int set) {
if (!set) {
socklen_t optlen = IFNAMSIZ;
static int nixio__gso_b(lua_State *L, int fd, int level, int opt, int set) {
if (!set) {
socklen_t optlen = IFNAMSIZ;
@@
-128,6
+130,8
@@
static int nixio__gso_b(lua_State *L, int fd, int level, int opt, int set) {
return nixio__perror(L);
}
return nixio__perror(L);
}
+#endif /* SO_BINDTODEVICE */
+
/**
* get/setsockopt() helper
*/
/**
* get/setsockopt() helper
*/
@@
-156,6
+160,10
@@
static int nixio__getsetsockopt(lua_State *L, int set) {
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_BROADCAST, set);
} else if (!strcmp(option, "dontroute")) {
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_DONTROUTE, set);
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_BROADCAST, set);
} else if (!strcmp(option, "dontroute")) {
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_DONTROUTE, set);
+ } else if (!strcmp(option, "error")) {
+ return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_ERROR, set);
+ } else if (!strcmp(option, "oobinline")) {
+ return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_OOBINLINE, set);
} else if (!strcmp(option, "linger")) {
return nixio__gso_ling(L, sock->fd, SOL_SOCKET, SO_LINGER, set);
} else if (!strcmp(option, "sndtimeo")) {
} else if (!strcmp(option, "linger")) {
return nixio__gso_ling(L, sock->fd, SOL_SOCKET, SO_LINGER, set);
} else if (!strcmp(option, "sndtimeo")) {
@@
-163,11
+171,15
@@
static int nixio__getsetsockopt(lua_State *L, int set) {
} else if (!strcmp(option, "rcvtimeo")) {
return nixio__gso_timev(L, sock->fd, SOL_SOCKET, SO_RCVTIMEO, set);
} else if (!strcmp(option, "bindtodevice")) {
} else if (!strcmp(option, "rcvtimeo")) {
return nixio__gso_timev(L, sock->fd, SOL_SOCKET, SO_RCVTIMEO, set);
} else if (!strcmp(option, "bindtodevice")) {
+#ifdef SO_BINDTODEVICE
return nixio__gso_b(L, sock->fd, SOL_SOCKET, SO_BINDTODEVICE, set);
return nixio__gso_b(L, sock->fd, SOL_SOCKET, SO_BINDTODEVICE, set);
+#else
+ return nixio__pstatus(L, !(errno = ENOPROTOOPT));
+#endif
} else {
return luaL_argerror(L, 3, "supported values: keepalive, reuseaddr,"
" sndbuf, rcvbuf, priority, broadcast, linger, sndtimeo, rcvtimeo,"
} else {
return luaL_argerror(L, 3, "supported values: keepalive, reuseaddr,"
" sndbuf, rcvbuf, priority, broadcast, linger, sndtimeo, rcvtimeo,"
- " dontroute, bindtodevice"
+ " dontroute, bindtodevice
, error, oobinline
"
);
}
} else if (!strcmp(level, "tcp")) {
);
}
} else if (!strcmp(level, "tcp")) {