+static int nixio__gso_b(lua_State *L, int fd, int level, int opt, int set) {
+ if (!set) {
+ socklen_t optlen = IFNAMSIZ;
+ char ifname[IFNAMSIZ];
+ if (!getsockopt(fd, level, opt, ifname, &optlen)) {
+ lua_pushlstring(L, ifname, optlen);
+ return 1;
+ }
+ } else {
+ size_t valuelen;
+ const char *value = luaL_checklstring(L, set, &valuelen);
+ luaL_argcheck(L, valuelen <= IFNAMSIZ, set, "invalid interface name");
+ if (!setsockopt(fd, level, opt, value, valuelen)) {
+ lua_pushboolean(L, 1);
+ return 1;
+ }
+ }
+ return nixio__perror(L);
+}
+