Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mod_zeroconf A Zero Configuration Registration Module for Apache 2.0.

Similar presentations


Presentation on theme: "Mod_zeroconf A Zero Configuration Registration Module for Apache 2.0."— Presentation transcript:

1 mod_zeroconf A Zero Configuration Registration Module for Apache 2.0

2 Sander Temme sander@temme.net

3 Agenda Technology Overview Zeroconf Applications mod_zeroconf for Apache 2.0 –Design –Demo –Code Walkthrough Q&A

4 What is Zeroconf? IETF Working Group –Formed in Sept. 1999 Usability of TCP/IP Enhancements to Existing Protocols Not SLP, …

5 What is Zeroconf?

6 TCP/IP Autoconfiguration Network naming Service Browsing

7 Technology Overview Link-local addressing multicast DNS DNS Service-Discovery

8 Link-local Addressing No Central Address Server Pick a Random Address –In 169.254.0.0/16 range Address Defense Can Work With Centrally Assigned Addresses

9 Link-local Addressing Printer Network 169.254.1.219 169.254.4.51 169.254.10.29 169.254.4.51

10 mDNS DNS-like Protocol Every Host Runs Responder Hosts Pick Own Names Communication over IP Multicast Link-local Resolves to Link-local or Regular Address

11 Printer 169.254.1.219 169.254.4.51 169.254.10.29 169.254.4.51 mDNS PC_BILL PC_LARRY lj21569478 Network Mac_Steve

12 DNS-SD Service Publishing and Browsing Uses Existing DNS Record types User Sees Only Service Names Works With mDNS or Regular DNS

13 DNS-SD Bill’s Files Larry’s Tunes Laserjet, Closet Under the Stairs Printer 169.254.1.219 169.254.4.51 169.254.10.29 169.254.4.51 PC_BILL PC_LARRY lj21569478 Network Mac_Steve Steve’s Movies

14 Applications Printer Configuration Music/Photo/Document Sharing Distributed Compilation Network gaming … (the sky is the limit)

15 Peer to Peer Chat

16 Sharing Tunes

17 Sharing Sites

18 Platform support MacOSX 10.2 and up Linux: several initiatives –Mandrake put it in the distribution –No one else so far Windows… –Link-local addressing works –Third-party mDNSResponder

19 Windows and Rendezvous

20 Zeroconf on Linux May need Link-local address –http://zeroconf.sourceforge.net/?selected=zciphttp://zeroconf.sourceforge.net/?selected=zcip –http://www.zeroconf.org/AVH-IPv4LL.chttp://www.zeroconf.org/AVH-IPv4LL.c Need mDNSResponder –tmdns or –Apple’s mDNSResponder or http://developer.apple.com/darwin/projects/rendezvous/ –zmdns, openmdns (search SourceForge) or –Howl or –Embeddable: mdnsd http://www.dotlocal.org/mdnsd/http://www.dotlocal.org/mdnsd/ –Running Java? Try http://jmdns.sourceforge.net/http://jmdns.sourceforge.net/

21 Zeroconf and Apache Goals –Publish Apache http services –Work with external mDNSResponder –Support Apache 2.0 –ASF Licensed Existing initiatives –mod_rendezvous: Apache 1.3, Mac only –mod_rendezvous_apple: ditto –mdnsmod: No code on SF, in ‘planning stage’

22 External mDNSResponder Apple mDNSResponder –No client libraries zmdns –Wrapper around Apple code –Mixed BSD, APSL –Alpha stage openmdns, tmdns –GPL

23 Howl Based on Apple code Modified BSD license At version 0.9.3, API should be stable Linux, Windows, MacOSX, … Plugin for Windows Internet Explorer http://www.porchdogsoft.com/products/

24 Configuration # En/disable Zeroconf server-wide. Default: off Zeroconf {on|off} # Register main server or virtualhost container. ZeroconfRegister “service name” [/partialpath] # This is part of the core ServerName hostname:port

25 Demo

26 mod_zeroconf Design Apache 2.0 Core Howl mDNSResponder mod_zeroconf Virtual Host Config Info mDNS Registration mDNS Callbacks

27 What Gets Registered? Service Name SRV information: port, hostname, partial URI Hostname/IP (if different) Callback function

28 mod_zeroconf Design Apache Core Howl mDNSResponder mod_zeroconf Virtual Host Config Info mDNS Registration mDNS Callbacks Callback Process

29 Registration Callbacks Network can be very dynamic Service name, Hostname conflicts Apache needs to respond Can’t block parent process: –fork a child

30 mod_zeroconf.c: post_config static int zc_post_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp, server_rec *s) { void *data; const char *userdata_key = "zeroconf_init_module"; apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (!data) { apr_pool_userdata_set((const void *) 1, userdata_key, apr_pool_cleanup_null, s->process->pool); } else {. } return OK; }

31 mod_zeroconf.c: config check /* Check if Zeroconf has been enabled globally. If not, bail here */ cfg = our_sconfig(s); if (cfg->enabled == 0) { return OK; } /* Still here? Let's go. */ TESTORBAIL(sw_rendezvous_init(&howl_session)); /* Get System Hostname (not shown) */ for (ws = s; ws; ws = ws->next) { cfg = our_sconfig(ws); if (cfg->serviceName) {. }

32 mod_zeroconf.c: TEXT Record if (cfg->partialURI) { TESTORBAIL(sw_text_record_init(&text_record)); TESTORBAIL(sw_text_record_add_key_and_string_value(text_record, "path", cfg->partialURI)); pathinfo = sw_text_record_bytes(text_record); pilength = sw_text_record_len(text_record); } else { pathinfo = NULL; pilength = 0; } serverport = ws->port == 0 ? 80 : ws->port; if (apr_strnatcasecmp(thehostname, ws->server_hostname) != 0) { zc_register_host(ws); }

33 mod_zeroconf.c: Publish! howl_result = sw_rendezvous_publish(howl_session, cfg->serviceName, "_http._tcp", NULL, ws->server_hostname, serverport, pathinfo, pilength, NULL, howl_publish_reply, (sw_opaque) ws, &howl_id); pubidPtr = apr_palloc(s->process->pool, sizeof(sw_rendezvous_publish_id)); *pubidPtr = howl_id; apr_pool_userdata_set(howl_id, cfg->serviceName, apr_pool_cleanup_null, ws->process->pool);

34 mod_zeroconf.c: Fork callback #if APR_HAS_FORK callbackchild = apr_palloc(s->process->pool, sizeof(apr_proc_t)); switch(forkstatus = apr_proc_fork(callbackchild, s->process->pool)) { case APR_INCHILD: sw_rendezvous_run(howl_session); break; /* Not reached */ case APR_INPARENT: apr_pool_note_subprocess(s->process->pool, callbackchild, APR_KILL_AFTER_TIMEOUT); break; default: ap_log_error(APLOG_MARK, APLOG_ERR, forkstatus, s, "Failed to fork callback child"); return HTTP_INTERNAL_SERVER_ERROR; } #endif /* APR_HAS_FORK */

35 mod_zeroconf: To-Dos Learn about https protocol Learn about DAV, … Port to MacOSX? Apache 1.3? Alternative mDNS implementations IPv6 compatibility More solid hostname registration Better callback code etc…

36 mod_zeroconf: Where? Project home page: –http://www.temme.net/sander/mod_zeroconf/http://www.temme.net/sander/mod_zeroconf/ Contact: –sander@temme.netsander@temme.net About Apache server: –http://httpd.apache.org/http://httpd.apache.org/ Apache modules: –apache-modules@covalent.netapache-modules@covalent.net

37 Conclusion Zeroconf is great Will make networks more usable Platform support needed across vendors Applications will follow mod_zeroconf is cool –Patches are welcome

38 Q&A


Download ppt "Mod_zeroconf A Zero Configuration Registration Module for Apache 2.0."

Similar presentations


Ads by Google