2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file vpn/gnunet-daemon-vpn.c
24 * @author Philipp Toelke
27 #include "gnunet_getopt_lib.h"
28 #include "gnunet_program_lib.h"
29 #include "gnunet_os_lib.h"
30 #include "gnunet-vpn-helper-p.h"
31 #include "gnunet-vpn-packet.h"
32 #include "gnunet-vpn-pretty-print.h"
33 #include "gnunet_common.h"
34 #include "gnunet_protocols.h"
35 #include "gnunet_server_lib.h"
36 #include "gnunet-service-dns-p.h"
37 #include "gnunet_client_lib.h"
38 #include "gnunet_container_lib.h"
39 #include "block_dns.h"
47 * The configuration to use
49 static const struct GNUNET_CONFIGURATION_Handle *cfg;
52 * PipeHandle to receive data from the helper
54 static struct GNUNET_DISK_PipeHandle* helper_in;
57 * PipeHandle to send data to the helper
59 static struct GNUNET_DISK_PipeHandle* helper_out;
62 * FileHandle to receive data from the helper
64 static const struct GNUNET_DISK_FileHandle* fh_from_helper;
67 * FileHandle to send data to the helper
69 static const struct GNUNET_DISK_FileHandle* fh_to_helper;
72 * The Message-Tokenizer that tokenizes the messages comming from the helper
74 static struct GNUNET_SERVER_MessageStreamTokenizer* mst;
77 * The connection to the service-dns
79 static struct GNUNET_CLIENT_Connection *dns_connection;
82 * A flag to show that the service-dns has to rehijack the outbound dns-packets
84 * This gets set when the helper restarts as the routing-tables are flushed when
85 * the interface vanishes.
87 static unsigned char restart_hijack;
90 * The process id of the helper
92 static struct GNUNET_OS_Process *helper_proc;
95 * a list of outgoing dns-query-packets
97 static struct query_packet_list *head;
100 * The last element of the list of outgoing dns-query-packets
102 static struct query_packet_list *tail;
105 * A list of processed dns-responses.
107 * "processed" means that the packet is complete and can be sent out via udp
110 static struct answer_packet_list *answer_proc_head;
113 * The last element of the list of processed dns-responses.
115 static struct answer_packet_list *answer_proc_tail;
118 * The hashmap containing the mappings from ipv6-addresses to gnunet-descriptors
120 static struct GNUNET_CONTAINER_MultiHashMap* hashmap;
123 struct GNUNET_vpn_service_descriptor desc;
131 static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx);
132 static void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg);
135 * Callback called by notify_transmit_ready; sends dns-queries or rehijack-messages
140 send_query(void* cls, size_t size, void* buf) {
143 * Send the rehijack-message
145 if (restart_hijack == 1)
149 * The message is just a header
151 GNUNET_assert(sizeof(struct GNUNET_MessageHeader) <= size);
152 struct GNUNET_MessageHeader* hdr = buf;
153 len = sizeof(struct GNUNET_MessageHeader);
154 hdr->size = htons(len);
155 hdr->type = htons(GNUNET_MESSAGE_TYPE_REHIJACK);
159 struct query_packet_list* query = head;
160 len = ntohs(query->pkt.hdr.size);
162 GNUNET_assert(len <= size);
164 memcpy(buf, &query->pkt.hdr, len);
166 GNUNET_CONTAINER_DLL_remove (head, tail, query);
172 * Check whether more data is to be sent
176 GNUNET_CLIENT_notify_transmit_ready(dns_connection, ntohs(head->pkt.hdr.size), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
178 else if (restart_hijack == 1)
180 GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
188 * Function scheduled as very last function, cleans up after us
192 cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) {
193 GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
195 /* stop the helper */
196 if (helper_proc != NULL)
198 GNUNET_OS_process_kill (helper_proc, SIGTERM);
199 GNUNET_OS_process_wait (helper_proc);
200 GNUNET_OS_process_close (helper_proc);
204 /* close the connection to the service-dns */
205 if (dns_connection != NULL)
207 GNUNET_CLIENT_disconnect (dns_connection, GNUNET_NO);
208 dns_connection = NULL;
214 * Start the helper-process
218 start_helper_and_schedule(void *cls,
219 const struct GNUNET_SCHEDULER_TaskContext *tc) {
220 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
223 helper_in = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO);
224 helper_out = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES);
226 if (helper_in == NULL || helper_out == NULL) return;
228 helper_proc = GNUNET_OS_start_process(helper_in, helper_out, "gnunet-helper-vpn", "gnunet-helper-vpn", NULL);
230 fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ);
231 fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE);
233 GNUNET_DISK_pipe_close_end(helper_out, GNUNET_DISK_PIPE_END_WRITE);
234 GNUNET_DISK_pipe_close_end(helper_in, GNUNET_DISK_PIPE_END_READ);
236 /* Tell the dns-service to rehijack the dns-port
237 * The routing-table gets flushed if an interface disappears.
240 GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
242 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, fh_from_helper, &helper_read, NULL);
247 * Restart the helper-process
251 restart_helper(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) {
253 GNUNET_OS_process_kill (helper_proc, SIGKILL);
254 GNUNET_OS_process_wait (helper_proc);
255 GNUNET_OS_process_close (helper_proc);
258 GNUNET_DISK_pipe_close(helper_in);
259 GNUNET_DISK_pipe_close(helper_out);
261 /* Restart the helper */
262 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, start_helper_and_schedule, NULL);
267 * Read from the helper-process
271 helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) {
272 /* no message can be bigger then 64k */
275 if (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)
278 int t = GNUNET_DISK_file_read(fh_from_helper, &buf, 65535);
280 /* On read-error, restart the helper */
282 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Read error for header from vpn-helper: %m\n");
283 GNUNET_SCHEDULER_add_now(restart_helper, cls);
287 /* FIXME */ GNUNET_SERVER_mst_receive(mst, NULL, buf, t, 0, 0);
289 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, fh_from_helper, &helper_read, NULL);
294 * Calculate the checksum of an IPv4-Header
297 calculate_ip_checksum(uint16_t* hdr, short len) {
299 for(; len >= 2; len -= 2)
302 sum += *((unsigned char*)hdr);
304 sum = (sum >> 16) + (sum & 0xFFFF);
310 * Send an dns-answer-packet to the helper
313 helper_write(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) {
314 if (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)
317 struct answer_packet_list* ans = answer_proc_head;
318 size_t len = ntohs(ans->pkt.hdr.size);
320 GNUNET_assert(ans->pkt.subtype == GNUNET_DNS_ANSWER_TYPE_IP);
322 GNUNET_assert (20 == sizeof (struct ip_hdr));
323 GNUNET_assert (8 == sizeof (struct udp_pkt));
324 size_t data_len = len - sizeof(struct answer_packet) + 1;
325 size_t net_len = sizeof(struct ip_hdr) + sizeof(struct udp_dns) + data_len;
326 size_t pkt_len = sizeof(struct GNUNET_MessageHeader) + sizeof(struct pkt_tun) + net_len;
328 struct ip_udp_dns* pkt = alloca(pkt_len);
329 memset(pkt, 0, pkt_len);
331 /* set the gnunet-header */
332 pkt->shdr.size = htons(pkt_len);
333 pkt->shdr.type = htons(GNUNET_MESSAGE_TYPE_VPN_HELPER);
335 /* set the tun-header (no flags and ethertype of IPv4) */
337 pkt->tun.type = htons(0x0800);
339 /* set the ip-header */
340 pkt->ip_hdr.version = 4;
341 pkt->ip_hdr.hdr_lngth = 5;
342 pkt->ip_hdr.diff_serv = 0;
343 pkt->ip_hdr.tot_lngth = htons(net_len);
344 pkt->ip_hdr.ident = 0;
345 pkt->ip_hdr.flags = 0;
346 pkt->ip_hdr.frag_off = 0;
347 pkt->ip_hdr.ttl = 255;
348 pkt->ip_hdr.proto = 0x11; /* UDP */
349 pkt->ip_hdr.chks = 0; /* Will be calculated later*/
350 pkt->ip_hdr.sadr = ans->pkt.from;
351 pkt->ip_hdr.dadr = ans->pkt.to;
353 pkt->ip_hdr.chks = calculate_ip_checksum((uint16_t*)&pkt->ip_hdr, 5*4);
355 /* set the udp-header */
356 pkt->udp_dns.udp_hdr.spt = htons(53);
357 pkt->udp_dns.udp_hdr.dpt = ans->pkt.dst_port;
358 pkt->udp_dns.udp_hdr.len = htons(net_len - sizeof(struct ip_hdr));
359 pkt->udp_dns.udp_hdr.crc = 0; /* Optional for IPv4 */
361 memcpy(&pkt->udp_dns.data, ans->pkt.data, data_len);
363 GNUNET_CONTAINER_DLL_remove (answer_proc_head, answer_proc_tail, ans);
366 /* FIXME */ GNUNET_DISK_file_write(fh_to_helper, pkt, pkt_len);
368 /* if more packets are available, reschedule */
369 if (answer_proc_head != NULL)
370 GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
377 * @return GNUNET_YES if a mapping exists
380 address_mapping_exists(unsigned char addr[]) {
381 GNUNET_HashCode* key = alloca(sizeof(GNUNET_HashCode));
382 memset(key, 0, sizeof(GNUNET_HashCode));
383 memcpy(key, addr, 16);
385 return GNUNET_CONTAINER_multihashmap_contains(hashmap, key);
389 send_icmp_response(void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) {
390 struct ip6_icmp* request = cls;
392 struct ip6_icmp* response = alloca(ntohs(request->shdr.size));
393 memset(response, 0, ntohs(request->shdr.size));
395 response->shdr.size = request->shdr.size;
396 response->shdr.type = htons(GNUNET_MESSAGE_TYPE_VPN_HELPER);
398 response->tun.flags = 0;
399 response->tun.type = htons(0x86dd);
401 response->ip6_hdr.hoplmt = 255;
402 response->ip6_hdr.paylgth = request->ip6_hdr.paylgth;
403 response->ip6_hdr.nxthdr = 0x3a;
404 response->ip6_hdr.version = 6;
405 memcpy(&response->ip6_hdr.sadr, &request->ip6_hdr.dadr, 16);
406 memcpy(&response->ip6_hdr.dadr, &request->ip6_hdr.sadr, 16);
408 response->icmp_hdr.code = 0;
409 response->icmp_hdr.type = 0x81;
411 /* Magic, more Magic! */
412 response->icmp_hdr.chks = request->icmp_hdr.chks - 0x1;
414 /* Copy the rest of the packet */
415 memcpy(response+1, request+1, ntohs(request->shdr.size) - sizeof(struct ip6_icmp));
417 /* FIXME */ GNUNET_DISK_file_write(fh_to_helper, response, ntohs(response->shdr.size));
419 GNUNET_free(request);
423 * Receive packets from the helper-process
426 message_token(void *cls,
428 const struct GNUNET_MessageHeader *message) {
429 GNUNET_assert(ntohs(message->type) == GNUNET_MESSAGE_TYPE_VPN_HELPER);
431 struct tun_pkt *pkt_tun = (struct tun_pkt*) message;
433 /* ethertype is ipv6 */
434 if (ntohs(pkt_tun->tun.type) == 0x86dd)
436 struct ip6_pkt *pkt6 = (struct ip6_pkt*) message;
437 GNUNET_assert(pkt6->ip6_hdr.version == 6);
438 struct ip6_tcp *pkt6_tcp;
439 struct ip6_udp *pkt6_udp;
440 struct ip6_icmp *pkt6_icmp;
443 switch(pkt6->ip6_hdr.nxthdr)
446 pkt6_tcp = (struct ip6_tcp*)pkt6;
447 pkt_printf_ip6tcp(pkt6_tcp);
450 pkt6_udp = (struct ip6_udp*)pkt6;
451 pkt_printf_ip6udp(pkt6_udp);
452 if (ntohs(pkt6_udp->udp_hdr.dpt) == 53) {
453 pkt_printf_ip6dns((struct ip6_udp_dns*)pkt6_udp);
458 pkt6_icmp = (struct ip6_icmp*)pkt6;
459 /* If this packet is an icmp-echo-request and a mapping exists, answer */
460 if (pkt6_icmp->icmp_hdr.type == 0x80 && address_mapping_exists(pkt6->ip6_hdr.dadr))
462 pkt6_icmp = GNUNET_malloc(ntohs(pkt6->shdr.size));
463 memcpy(pkt6_icmp, pkt6, ntohs(pkt6->shdr.size));
464 GNUNET_SCHEDULER_add_now(&send_icmp_response, pkt6_icmp);
469 /* ethertype is ipv4 */
470 else if (ntohs(pkt_tun->tun.type) == 0x0800)
472 struct ip_pkt *pkt = (struct ip_pkt*) message;
473 struct ip_udp *udp = (struct ip_udp*) message;
474 GNUNET_assert(pkt->ip_hdr.version == 4);
476 /* Send dns-packets to the service-dns */
477 if (pkt->ip_hdr.proto == 0x11 && ntohs(udp->udp_hdr.dpt) == 53 )
479 /* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */
480 size_t len = sizeof(struct query_packet) + ntohs(udp->udp_hdr.len) - 9;
482 struct query_packet_list* query = GNUNET_malloc(len + 2*sizeof(struct query_packet_list*));
483 query->pkt.hdr.type = htons(GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS);
484 query->pkt.hdr.size = htons(len);
485 query->pkt.orig_to = pkt->ip_hdr.dadr;
486 query->pkt.orig_from = pkt->ip_hdr.sadr;
487 query->pkt.src_port = udp->udp_hdr.spt;
488 memcpy(query->pkt.data, udp->data, ntohs(udp->udp_hdr.len) - 8);
490 GNUNET_CONTAINER_DLL_insert_after(head, tail, tail, query);
492 if (dns_connection != NULL)
493 GNUNET_CLIENT_notify_transmit_ready(dns_connection,
495 GNUNET_TIME_UNIT_FOREVER_REL,
504 * Connect to the service-dns
507 connect_to_service_dns (void *cls,
508 const struct GNUNET_SCHEDULER_TaskContext *tc) {
509 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
511 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n");
512 GNUNET_assert (dns_connection == NULL);
513 dns_connection = GNUNET_CLIENT_connect ("dns", cfg);
514 GNUNET_CLIENT_receive(dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
516 /* If a packet is already in the list, schedule to send it */
518 GNUNET_CLIENT_notify_transmit_ready(dns_connection,
519 ntohs(head->pkt.hdr.size),
520 GNUNET_TIME_UNIT_FOREVER_REL,
524 else if (restart_hijack == 1)
526 GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
531 * Create a new Address from an answer-packet
535 new_ip6addr(char* buf, struct answer_packet* pkt) {
536 memcpy(buf, (int[]){htons(0x1234)}, 2);
537 memcpy(buf+2, &pkt->service_descr.service_descriptor, 6);
538 memcpy(buf+8, &pkt->service_descr.peer, 8);
543 * This gets scheduled with cls pointing to an answer_packet and does everything
544 * needed in order to send it to the helper.
546 * At the moment this means "inventing" and IPv6-Address for .gnunet-services and
547 * doing nothing for "real" services.
550 process_answer(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tc) {
551 struct answer_packet* pkt = cls;
552 struct answer_packet_list* list;
554 /* This answer is about a .gnunet-service
556 * It contains an almost complete DNS-Response, we have to fill in the ip
557 * at the offset pkt->addroffset
560 if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE)
562 pkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
565 memset(&key, 0, sizeof(GNUNET_HashCode));
566 new_ip6addr((char*)&key, pkt);
568 uint16_t namelen = strlen((char*)pkt->data+12)+1;
570 struct map_entry* value = GNUNET_malloc(sizeof(struct GNUNET_vpn_service_descriptor) + 2 + namelen);
572 value->namelen = namelen;
573 memcpy(value->name, pkt->data+12, namelen);
575 memcpy(&value->desc, &pkt->service_descr, sizeof(struct GNUNET_vpn_service_descriptor));
577 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(hashmap,
580 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
582 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not store to hashmap\n");
585 memcpy(((char*)pkt)+ntohs(pkt->addroffset), &key, 16);
587 list = GNUNET_malloc(htons(pkt->hdr.size) + 2*sizeof(struct answer_packet_list*));
589 memcpy(&list->pkt, pkt, htons(pkt->hdr.size));
592 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_REV)
595 memset(&key, 0, sizeof key);
596 unsigned char* k = (unsigned char*)&key;
597 unsigned char* s = pkt->data+12;
599 /* Whoever designed the reverse IPv6-lookup is batshit insane */
600 for (i = 0; i < 16; i++)
602 unsigned char c1 = s[(4*i)+1];
603 unsigned char c2 = s[(4*i)+3];
607 k[15-i] = c1 - 87; /* 87 is the difference between 'a' and 10 */
609 k[15-i] += 16*(c2 - '0');
611 k[15-i] += 16*(c2 - 87);
614 struct map_entry* map_entry = GNUNET_CONTAINER_multihashmap_get(hashmap, &key);
615 unsigned short offset = ntohs(pkt->addroffset);
617 if (map_entry == NULL)
623 unsigned short namelen = htons(map_entry->namelen);
624 char* name = map_entry->name;
626 list = GNUNET_malloc(2*sizeof(struct answer_packet_list*) + offset + 2 + ntohs(namelen));
628 struct answer_packet* rpkt = &list->pkt;
630 memcpy(rpkt, pkt, offset);
632 rpkt->subtype = GNUNET_DNS_ANSWER_TYPE_IP;
633 rpkt->hdr.size = ntohs(offset + 2 + ntohs(namelen));
635 memcpy(((char*)rpkt)+offset, &namelen, 2);
636 memcpy(((char*)rpkt)+offset+2, name, ntohs(namelen));
639 else if (pkt->subtype == GNUNET_DNS_ANSWER_TYPE_IP)
641 list = GNUNET_malloc(htons(pkt->hdr.size) + 2*sizeof(struct answer_packet_list*));
642 memcpy(&list->pkt, pkt, htons(pkt->hdr.size));
653 GNUNET_CONTAINER_DLL_insert_after(answer_proc_head, answer_proc_tail, answer_proc_tail, list);
655 GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, fh_to_helper, &helper_write, NULL);
661 * This receives packets from the service-dns and schedules process_answer to
665 dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) {
666 /* the service disconnected, reconnect after short wait */
669 GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO);
670 dns_connection = NULL;
671 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
672 &connect_to_service_dns,
677 /* the service did something strange, reconnect immediately */
678 if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS))
681 GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO);
682 dns_connection = NULL;
683 GNUNET_SCHEDULER_add_now (&connect_to_service_dns,
687 void *pkt = GNUNET_malloc(ntohs(msg->size));
689 memcpy(pkt, msg, ntohs(msg->size));
691 GNUNET_SCHEDULER_add_now(process_answer, pkt);
692 GNUNET_CLIENT_receive(dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
696 * Main function that will be run by the scheduler.
699 * @param args remaining command-line arguments
700 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
701 * @param cfg configuration
707 const struct GNUNET_CONFIGURATION_Handle *cfg_) {
708 mst = GNUNET_SERVER_mst_create(&message_token, NULL);
711 hashmap = GNUNET_CONTAINER_multihashmap_create(65536);
712 GNUNET_SCHEDULER_add_now (connect_to_service_dns, NULL);
713 GNUNET_SCHEDULER_add_now (start_helper_and_schedule, NULL);
714 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
718 * The main function to obtain template from gnunetd.
720 * @param argc number of arguments from the command line
721 * @param argv command line arguments
722 * @return 0 ok, 1 on error
725 main (int argc, char *const *argv) {
726 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
727 GNUNET_GETOPT_OPTION_END
731 GNUNET_PROGRAM_run (argc,
734 gettext_noop ("help text"),
735 options, &run, NULL)) ? ret : 1;
738 /* end of gnunet-daemon-vpn.c */