diff --git a/package/6in4/Makefile b/package/6in4/Makefile index 75e784882..289d28ee3 100644 --- a/package/6in4/Makefile +++ b/package/6in4/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=6in4 -PKG_VERSION:=3 +PKG_VERSION:=4 PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/6in4/files/6in4.sh b/package/6in4/files/6in4.sh index 5e416ee0b..a119138d0 100755 --- a/package/6in4/files/6in4.sh +++ b/package/6in4/files/6in4.sh @@ -2,13 +2,13 @@ # Copyright (c) 2010 OpenWrt.org find_6in4_wanif() { - local if=$(ip -4 r l e 0/0); if="${if#default via * dev }"; if="${if%% *}" + local if=$(ip -4 r l e 0/0); if="${if#default* dev }"; if="${if%% *}" [ -n "$if" ] && grep -qs "^ *$if:" /proc/net/dev && echo "$if" } find_6in4_wanip() { local ip=$(ip -4 a s dev "$1"); ip="${ip#*inet }" - echo "${ip%%/[0-9]* brd *}" + echo "${ip%%[^0-9.]*}" } # Hook into scan_interfaces() to synthesize a .device option diff --git a/package/kernel/modules/video.mk b/package/kernel/modules/video.mk index 6bc19fd4f..1fcfcf184 100644 --- a/package/kernel/modules/video.mk +++ b/package/kernel/modules/video.mk @@ -11,7 +11,7 @@ VIDEO_MENU:=Video Support define KernelPackage/video-core SUBMENU:=$(VIDEO_MENU) TITLE=Video4Linux support - DEPENDS:=@PCI_SUPPORT||USB_SUPPORT + DEPENDS:=@PCI_SUPPORT||USB_SUPPORT +kmod-i2c-core KCONFIG:= \ CONFIG_MEDIA_SUPPORT=m \ CONFIG_VIDEO_DEV \ @@ -99,7 +99,7 @@ $(eval $(call KernelPackage,video-ov511)) define KernelPackage/video-ovcamchip -$(call KernelPackage/video/Depends,@LINUX_2_6 @USB_SUPPORT +kmod-i2c-core) +$(call KernelPackage/video/Depends,@LINUX_2_6 @USB_SUPPORT +kmod-usb-core) TITLE:=OV6xxx/OV7xxx Camera Chip support KCONFIG:=CONFIG_VIDEO_OVCAMCHIP FILES:=$(LINUX_DIR)/drivers/media/video/ovcamchip/ovcamchip.$(LINUX_KMOD_SUFFIX) @@ -150,7 +150,7 @@ endef $(eval $(call KernelPackage,video-pwc)) define KernelPackage/video-uvc -$(call KernelPackage/video/Depends,@LINUX_2_6 @USB_SUPPORT +kmod-usb-core) +$(call KernelPackage/video/Depends,@LINUX_2_6 @USB_SUPPORT +kmod-usb-core +!TARGET_x86:kmod-input-core) TITLE:=USB Video Class (UVC) support KCONFIG:= CONFIG_USB_VIDEO_CLASS FILES:=$(LINUX_DIR)/drivers/media/video/uvc/uvcvideo.$(LINUX_KMOD_SUFFIX) diff --git a/package/uhttpd/Makefile b/package/uhttpd/Makefile index eb4238c90..cb85ad88c 100644 --- a/package/uhttpd/Makefile +++ b/package/uhttpd/Makefile @@ -8,9 +8,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=11 +PKG_RELEASE:=14 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) +PKG_BUILD_DEPENDS := libcyassl liblua include $(INCLUDE_DIR)/package.mk diff --git a/package/uhttpd/files/uhttpd.config b/package/uhttpd/files/uhttpd.config index acdd62ea4..534e8f8b2 100644 --- a/package/uhttpd/files/uhttpd.config +++ b/package/uhttpd/files/uhttpd.config @@ -12,6 +12,11 @@ config uhttpd main # Server document root option home /www + # Reject requests from RFC1918 IP addresses + # directed to the servers public IP(s). + # This is a DNS rebinding countermeasure. + option rfc1918_filter 1 + # Certificate and private key for HTTPS. # If no listen_https addresses are given, # the key options are ignored. diff --git a/package/uhttpd/files/uhttpd.init b/package/uhttpd/files/uhttpd.init index 58f980c42..8221d859b 100755 --- a/package/uhttpd/files/uhttpd.init +++ b/package/uhttpd/files/uhttpd.init @@ -17,6 +17,17 @@ append_arg() { [ -n "$val" -o -n "$def" ] && append UHTTPD_ARGS "$opt ${val:-$def}" } +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && append UHTTPD_ARGS "$opt" +} + generate_keys() { local cfg="$1" local key="$2" @@ -34,11 +45,7 @@ generate_keys() { $PX5G_BIN selfsigned -der \ -days ${days:-730} -newkey rsa:${bits:-1024} -keyout "$UHTTPD_KEY" -out "$UHTTPD_CERT" \ -subj /C=${country:-DE}/ST=${state:-Saxony}/L=${location:-Leipzig}/CN=${commonname:-OpenWrt} - } || { - echo "WARNING: the specified certificate and key" \ - "files do not exist and the px5g generator" \ - "is not available, skipping SSL setup." - } + } } start_instance() @@ -59,6 +66,12 @@ start_instance() append_arg "$cfg" lua_handler "-L" append_arg "$cfg" script_timeout "-t" append_arg "$cfg" network_timeout "-T" + append_arg "$cfg" error_page "-E" + append_arg "$cfg" index_page "-I" + + append_bool "$cfg" no_symlinks "-S" 0 + append_bool "$cfg" no_dirlists "-D" 0 + append_bool "$cfg" rfc1918_filter "-R" 0 config_get http "$cfg" listen_http for listen in $http; do diff --git a/package/uhttpd/src/uhttpd-cgi.c b/package/uhttpd/src/uhttpd-cgi.c index 855a72f56..086124916 100644 --- a/package/uhttpd/src/uhttpd-cgi.c +++ b/package/uhttpd/src/uhttpd-cgi.c @@ -234,6 +234,17 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf if( pi->info ) setenv("PATH_INFO", pi->info, 1); + /* REDIRECT_STATUS, php-cgi wants it */ + switch( req->redirect_status ) + { + case 404: + setenv("REDIRECT_STATUS", "404", 1); + break; + + default: + setenv("REDIRECT_STATUS", "200", 1); + break; + } /* http version */ if( req->version > 1.0 ) diff --git a/package/uhttpd/src/uhttpd-file.c b/package/uhttpd/src/uhttpd-file.c index 81f66a34b..ef9a77b6c 100644 --- a/package/uhttpd/src/uhttpd-file.c +++ b/package/uhttpd/src/uhttpd-file.c @@ -29,7 +29,7 @@ static const char * uh_file_mime_lookup(const char *path) { struct mimetype *m = &uh_mime_types[0]; - char *e; + const char *e; while( m->extn ) { @@ -97,36 +97,39 @@ static char * uh_file_header_lookup(struct http_request *req, const char *name) return NULL; } +#define ensure_ret(x) \ + do { if( x < 0 ) return; } while(0) + static void uh_file_response_ok_hdrs(struct client *cl, struct http_request *req, struct stat *s) { - uh_http_sendf(cl, NULL, "Connection: close\r\n"); + ensure_ret(uh_http_sendf(cl, NULL, "Connection: close\r\n")); if( s ) { - uh_http_sendf(cl, NULL, "ETag: %s\r\n", uh_file_mktag(s)); - uh_http_sendf(cl, NULL, "Last-Modified: %s\r\n", uh_file_unix2date(s->st_mtime)); + ensure_ret(uh_http_sendf(cl, NULL, "ETag: %s\r\n", uh_file_mktag(s))); + ensure_ret(uh_http_sendf(cl, NULL, "Last-Modified: %s\r\n", uh_file_unix2date(s->st_mtime))); } - uh_http_sendf(cl, NULL, "Date: %s\r\n", uh_file_unix2date(time(NULL))); + ensure_ret(uh_http_sendf(cl, NULL, "Date: %s\r\n", uh_file_unix2date(time(NULL)))); } static void uh_file_response_200(struct client *cl, struct http_request *req, struct stat *s) { - uh_http_sendf(cl, NULL, "HTTP/%.1f 200 OK\r\n", req->version); + ensure_ret(uh_http_sendf(cl, NULL, "HTTP/%.1f 200 OK\r\n", req->version)); uh_file_response_ok_hdrs(cl, req, s); } static void uh_file_response_304(struct client *cl, struct http_request *req, struct stat *s) { - uh_http_sendf(cl, NULL, "HTTP/%.1f 304 Not Modified\r\n", req->version); + ensure_ret(uh_http_sendf(cl, NULL, "HTTP/%.1f 304 Not Modified\r\n", req->version)); uh_file_response_ok_hdrs(cl, req, s); } static void uh_file_response_412(struct client *cl, struct http_request *req) { - uh_http_sendf(cl, NULL, + ensure_ret(uh_http_sendf(cl, NULL, "HTTP/%.1f 412 Precondition Failed\r\n" - "Connection: close\r\n", req->version); + "Connection: close\r\n", req->version)); } static int uh_file_if_match(struct client *cl, struct http_request *req, struct stat *s) @@ -244,6 +247,9 @@ static int uh_file_if_unmodified_since(struct client *cl, struct http_request *r } +#define ensure_out(x) \ + do { if( x < 0 ) goto out; } while(0) + static int uh_file_scandir_filter_dir(const struct dirent *e) { return strcmp(e->d_name, ".") ? 1 : 0; @@ -251,17 +257,18 @@ static int uh_file_scandir_filter_dir(const struct dirent *e) static void uh_file_dirlist(struct client *cl, struct http_request *req, struct path_info *pi) { - int i, count; + int i; + int count = 0; char filename[PATH_MAX]; char *pathptr; struct dirent **files = NULL; struct stat s; - uh_http_sendf(cl, req, + ensure_out(uh_http_sendf(cl, req, "