ASF Bugzilla – Attachment 16773 Details for
Bug 37201
Add <IfInterface IP> syntax to apache configuration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
server/core.c patch
core.c.patch (text/plain), 2.96 KB, created by
Glenn Nielsen
on 2005-10-21 21:15:05 UTC
(
hide
)
Description:
server/core.c patch
Filename:
MIME Type:
Creator:
Glenn Nielsen
Created:
2005-10-21 21:15:05 UTC
Size:
2.96 KB
patch
obsolete
>--- server/core.c.orig Thu Sep 29 01:47:05 2005 >+++ server/core.c Fri Oct 21 13:39:02 2005 >@@ -1965,6 +1965,78 @@ > } > } > >+static const char *start_ifinterface(cmd_parms *cmd, void *dummy, const char *arg) >+{ >+ const char *endp; >+ int ipconfigured = 0; >+ int not = 0; >+ char *host, *scope_id; >+ apr_port_t port; >+ apr_status_t rv; >+ apr_socket_t *tmp_sock; >+ apr_sockaddr_t *sa; >+ >+ endp = ap_strrchr_c(arg, '>'); >+ if (endp == NULL) { >+ return unclosed_directive(cmd); >+ } >+ >+ arg = apr_pstrndup(cmd->pool, arg, endp - arg); >+ >+ if (arg[0] == '!') { >+ not = 1; >+ arg++; >+ } >+ >+ rv = apr_parse_addr_port(&host, &scope_id, &port, arg, cmd->pool); >+ if (rv != APR_SUCCESS) { >+ return "Invalid address or port"; >+ } >+ >+ if (!host || !strcmp(host, "*")) { >+ return "A host IP address must be set"; >+ } >+ >+ if (scope_id) { >+ /* XXX scope id support is useful with link-local IPv6 addresses */ >+ return "Scope id is not supported"; >+ } >+ >+ if ((rv = apr_socket_create(&tmp_sock, APR_INET, SOCK_STREAM, cmd->pool)) >+ == APR_SUCCESS) { >+ if ((rv = apr_sockaddr_info_get(&sa, host, APR_INET, 0, 0, cmd->pool)) == APR_SUCCESS) { >+ if ((rv = apr_bind(tmp_sock, sa)) == APR_SUCCESS) { >+ ipconfigured = 1; >+ } >+ } >+ apr_socket_close(tmp_sock); >+ } >+ >+ if (ipconfigured) { >+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, cmd->server, >+ "IfInterface: IP available on network interface %s", arg); >+ } >+ else { >+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, rv, cmd->server, >+ "IfInterface: IP not available on network interface %s", arg); >+ } >+ >+ if ((!not && ipconfigured) || (not && !ipconfigured)) { >+ ap_directive_t *parent = NULL; >+ ap_directive_t *current = NULL; >+ const char *retval; >+ >+ retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd, >+ ¤t, &parent, "<IfInterface"); >+ *(ap_directive_t **)dummy = current; >+ return retval; >+ } >+ else { >+ *(ap_directive_t **)dummy = NULL; >+ return ap_soak_end_container(cmd, "<IfInterface"); >+ } >+} >+ > /* httpd.conf commands... beginning with the <VirtualHost> business */ > > static const char *virtualhost_section(cmd_parms *cmd, void *dummy, >@@ -3170,6 +3242,8 @@ > "Container for directives based on existance of specified modules"), > AP_INIT_TAKE1("<IfDefine", start_ifdefine, NULL, EXEC_ON_READ | OR_ALL, > "Container for directives based on existance of command line defines"), >+AP_INIT_TAKE1("<IfInterface", start_ifinterface, NULL, EXEC_ON_READ | OR_ALL, >+ "Container for directives based on an IP Address configured on the host network interface"), > AP_INIT_RAW_ARGS("<DirectoryMatch", dirsection, (void*)1, RSRC_CONF, > "Container for directives affecting resources located in the " > "specified directories"),
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37201
:
16773
|
16776