1 /*- 2 * Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29 #include <sys/param.h> 30 #include <sys/socket.h> 31 #include <sys/un.h> 32 #include <netinet/in.h> 33 #include <arpa/inet.h> 34 #include <netdb.h> 35 #include <netgraph.h> 36 #include <net/ethernet.h> 37 #include <netinet/in_systm.h> 38 #include <netinet/ip.h> 39 #include <netgraph/ng_ether.h> 40 #include <netgraph/ng_message.h> 41 #include <netgraph/ng_pppoe.h> 42 #include <netgraph/ng_socket.h> 43 44 #include <errno.h> 45 #include <paths.h> 46 #include <signal.h> 47 #include <stdio.h> 48 #include <stdarg.h> 49 #include <stdlib.h> 50 #include <string.h> 51 #include <sysexits.h> 52 #include <sys/fcntl.h> 53 #ifndef NOKLDLOAD 54 #include <sys/linker.h> 55 #include <sys/module.h> 56 #endif 57 #include <sys/uio.h> 58 #include <sys/wait.h> 59 #include <syslog.h> 60 #include <termios.h> 61 #include <unistd.h> 62 63 64 #define DEFAULT_EXEC_PREFIX "exec /usr/sbin/ppp -direct " 65 66 static int ReceivedSignal; 67 68 static int 69 usage(const char *prog) 70 { 71 fprintf(stderr, "Usage: %s [-Fd] [-P pidfile] [-a name] [-e exec | -l label]" 72 " [-p provider] interface\n", prog); 73 return EX_USAGE; 74 } 75 76 static void 77 Farewell(int sig) 78 { 79 ReceivedSignal = sig; 80 } 81 82 static int 83 ConfigureNode(const char *prog, const char *iface, const char *provider, 84 int cs, int ds, int debug, struct ngm_connect *ngc) 85 { 86 /* 87 * We're going to do this with the passed `ds' & `cs' descriptors: 88 * 89 * .---------. 90 * | ether | 91 * | <iface> | 92 * `---------' 93 * (orphan) ds cs 94 * | | | 95 * | | | 96 * (ethernet) | | 97 * .---------. .-----------. 98 * | pppoe | | socket | 99 * | <iface> |(pppoe-<pid>)<---->(pppoe-<pid>)| <unnamed> | 100 * `--------- `-----------' 101 * (exec-<pid>) 102 * ^ .-----------. .-------------. 103 * | | socket | | ppp -direct | 104 * `--->(exec-<pid>)| <unnamed> |--fd--| provider | 105 * `-----------' `-------------' 106 * 107 * where there are potentially many ppp processes running off of the 108 * same PPPoE node. 109 * The exec-<pid> hook isn't made 'till we Spawn(). 110 */ 111 112 char *epath, *spath; 113 struct ngpppoe_init_data *data; 114 const struct hooklist *hlist; 115 const struct nodeinfo *ninfo; 116 const struct linkinfo *nlink; 117 struct ngm_mkpeer mkp; 118 struct ng_mesg *resp; 119 u_char rbuf[2048]; 120 int f, plen; 121 122 /* 123 * Ask for a list of hooks attached to the "ether" node. This node should 124 * magically exist as a way of hooking stuff onto an ethernet device 125 */ 126 epath = (char *)alloca(strlen(iface) + 2); 127 sprintf(epath, "%s:", iface); 128 129 if (debug) 130 fprintf(stderr, "Sending NGM_LISTHOOKS to %s\n", epath); 131 132 if (NgSendMsg(cs, epath, NGM_GENERIC_COOKIE, NGM_LISTHOOKS, NULL, 0) < 0) { 133 if (errno == ENOENT) 134 fprintf(stderr, "%s Cannot send a netgraph message: Invalid interface\n", 135 epath); 136 else 137 fprintf(stderr, "%s Cannot send a netgraph message: %s\n", 138 epath, strerror(errno)); 139 return EX_UNAVAILABLE; 140 } 141 142 /* Get our list back */ 143 resp = (struct ng_mesg *)rbuf; 144 if (NgRecvMsg(cs, resp, sizeof rbuf, NULL) < 0) { 145 perror("Cannot get netgraph response"); 146 return EX_UNAVAILABLE; 147 } 148 149 hlist = (const struct hooklist *)resp->data; 150 ninfo = &hlist->nodeinfo; 151 152 if (debug) 153 fprintf(stderr, "Got reply from id [%x]: Type %s with %d hooks\n", 154 ninfo->id, ninfo->type, ninfo->hooks); 155 156 /* Make sure we've got the right type of node */ 157 if (strncmp(ninfo->type, NG_ETHER_NODE_TYPE, sizeof NG_ETHER_NODE_TYPE - 1)) { 158 fprintf(stderr, "%s Unexpected node type ``%s'' (wanted ``" 159 NG_ETHER_NODE_TYPE "'')\n", epath, ninfo->type); 160 return EX_DATAERR; 161 } 162 163 /* look for a hook already attached. */ 164 for (f = 0; f < ninfo->hooks; f++) { 165 nlink = &hlist->link[f]; 166 167 if (debug) 168 fprintf(stderr, " Got [%x]:%s -> [%x]:%s\n", ninfo->id, 169 nlink->ourhook, nlink->nodeinfo.id, nlink->peerhook); 170 171 if (!strcmp(nlink->ourhook, NG_ETHER_HOOK_ORPHAN) || 172 !strcmp(nlink->ourhook, NG_ETHER_HOOK_DIVERT)) { 173 /* 174 * Something is using the data coming out of this `ether' node. 175 * If it's a PPPoE node, we use that node, otherwise we complain that 176 * someone else is using the node. 177 */ 178 if (strcmp(nlink->nodeinfo.type, NG_PPPOE_NODE_TYPE)) { 179 fprintf(stderr, "%s Node type %s is currently active\n", 180 epath, nlink->nodeinfo.type); 181 return EX_UNAVAILABLE; 182 } 183 break; 184 } 185 } 186 187 if (f == ninfo->hooks) { 188 /* 189 * Create a new PPPoE node connected to the `ether' node using 190 * the magic `orphan' and `ethernet' hooks 191 */ 192 snprintf(mkp.type, sizeof mkp.type, "%s", NG_PPPOE_NODE_TYPE); 193 snprintf(mkp.ourhook, sizeof mkp.ourhook, "%s", NG_ETHER_HOOK_ORPHAN); 194 snprintf(mkp.peerhook, sizeof mkp.peerhook, "%s", NG_PPPOE_HOOK_ETHERNET); 195 196 if (debug) 197 fprintf(stderr, "Send MKPEER: %s%s -> [type %s]:%s\n", epath, 198 mkp.ourhook, mkp.type, mkp.peerhook); 199 200 if (NgSendMsg(cs, epath, NGM_GENERIC_COOKIE, 201 NGM_MKPEER, &mkp, sizeof mkp) < 0) { 202 fprintf(stderr, "%s Cannot create a peer PPPoE node: %s\n", 203 epath, strerror(errno)); 204 return EX_OSERR; 205 } 206 } 207 208 /* Connect the PPPoE node to our socket node. */ 209 snprintf(ngc->path, sizeof ngc->path, "%s%s", epath, NG_ETHER_HOOK_ORPHAN); 210 snprintf(ngc->ourhook, sizeof ngc->ourhook, "pppoe-%ld", (long)getpid()); 211 memcpy(ngc->peerhook, ngc->ourhook, sizeof ngc->peerhook); 212 213 if (NgSendMsg(cs, ".:", NGM_GENERIC_COOKIE, 214 NGM_CONNECT, ngc, sizeof *ngc) < 0) { 215 perror("Cannot CONNECT PPPoE and socket nodes"); 216 return EX_OSERR; 217 } 218 219 plen = strlen(provider); 220 221 data = (struct ngpppoe_init_data *)alloca(sizeof *data + plen); 222 snprintf(data->hook, sizeof data->hook, "%s", ngc->peerhook); 223 memcpy(data->data, provider, plen); 224 data->data_len = plen; 225 226 spath = (char *)alloca(strlen(ngc->peerhook) + 3); 227 strcpy(spath, ".:"); 228 strcpy(spath + 2, ngc->ourhook); 229 230 if (debug) { 231 if (provider) 232 fprintf(stderr, "Sending PPPOE_LISTEN to %s, provider %s\n", 233 spath, provider); 234 else 235 fprintf(stderr, "Sending PPPOE_LISTEN to %s\n", spath); 236 } 237 238 if (NgSendMsg(cs, spath, NGM_PPPOE_COOKIE, NGM_PPPOE_LISTEN, 239 data, sizeof *data + plen) == -1) { 240 fprintf(stderr, "%s: Cannot LISTEN on netgraph node: %s\n", 241 spath, strerror(errno)); 242 return EX_OSERR; 243 } 244 245 return 0; 246 } 247 248 static void 249 Spawn(const char *prog, const char *acname, const char *provider, 250 const char *exec, 251 struct ngm_connect ngc, int cs, int ds, void *request, int sz, 252 int debug) 253 { 254 char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)]; 255 struct ng_mesg *rep = (struct ng_mesg *)msgbuf; 256 struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep); 257 struct ngpppoe_init_data *data; 258 char unknown[14], *path; 259 const char *msg; 260 int ret, slen; 261 262 switch ((ret = fork())) { 263 case -1: 264 syslog(LOG_ERR, "fork: %m"); 265 break; 266 267 case 0: 268 switch (fork()) { 269 case 0: 270 break; 271 case -1: 272 _exit(errno); 273 default: 274 _exit(0); 275 } 276 close(cs); 277 close(ds); 278 279 /* Create a new socket node */ 280 if (debug) 281 syslog(LOG_INFO, "Creating a new socket node"); 282 283 if (NgMkSockNode(NULL, &cs, &ds) == -1) { 284 syslog(LOG_ERR, "Cannot create netgraph socket node: %m"); 285 _exit(EX_CANTCREAT); 286 } 287 288 /* Connect the PPPoE node to our new socket node. */ 289 snprintf(ngc.ourhook, sizeof ngc.ourhook, "exec-%ld", (long)getpid()); 290 memcpy(ngc.peerhook, ngc.ourhook, sizeof ngc.peerhook); 291 292 if (debug) 293 syslog(LOG_INFO, "Sending CONNECT from .:%s -> %s.%s", 294 ngc.ourhook, ngc.path, ngc.peerhook); 295 if (NgSendMsg(cs, ".:", NGM_GENERIC_COOKIE, 296 NGM_CONNECT, &ngc, sizeof ngc) < 0) { 297 syslog(LOG_ERR, "Cannot CONNECT PPPoE and socket nodes: %m"); 298 _exit(EX_OSERR); 299 } 300 301 /* 302 * If we tell the socket node not to LINGER, it will go away when 303 * the last hook is removed. 304 */ 305 if (debug) 306 syslog(LOG_INFO, "Sending NGM_SOCK_CMD_NOLINGER to socket"); 307 if (NgSendMsg(cs, ".:", NGM_SOCKET_COOKIE, 308 NGM_SOCK_CMD_NOLINGER, NULL, 0) < 0) { 309 syslog(LOG_ERR, "Cannot send NGM_SOCK_CMD_NOLINGER: %m"); 310 _exit(EX_OSERR); 311 } 312 313 /* Put the PPPoE node into OFFER mode */ 314 slen = strlen(acname); 315 data = (struct ngpppoe_init_data *)alloca(sizeof *data + slen); 316 snprintf(data->hook, sizeof data->hook, "%s", ngc.ourhook); 317 memcpy(data->data, acname, slen); 318 data->data_len = slen; 319 320 path = (char *)alloca(strlen(ngc.ourhook) + 3); 321 strcpy(path, ".:"); 322 strcpy(path + 2, ngc.ourhook); 323 324 syslog(LOG_INFO, "Offering to %s as access concentrator %s", 325 path, acname); 326 if (NgSendMsg(cs, path, NGM_PPPOE_COOKIE, NGM_PPPOE_OFFER, 327 data, sizeof *data + slen) == -1) { 328 syslog(LOG_INFO, "%s: Cannot OFFER on netgraph node: %m", path); 329 _exit(EX_OSERR); 330 } 331 /* If we have a provider code, set it */ 332 if (provider) { 333 slen = strlen(provider); 334 data = (struct ngpppoe_init_data *)alloca(sizeof *data + slen); 335 snprintf(data->hook, sizeof data->hook, "%s", ngc.ourhook); 336 memcpy(data->data, provider, slen); 337 data->data_len = slen; 338 339 syslog(LOG_INFO, "adding to %s as offered service %s", 340 path, acname); 341 if (NgSendMsg(cs, path, NGM_PPPOE_COOKIE, NGM_PPPOE_SERVICE, 342 data, sizeof *data + slen) == -1) { 343 syslog(LOG_INFO, "%s: Cannot add service on netgraph node: %m", path); 344 _exit(EX_OSERR); 345 } 346 } 347 348 /* And send our request data to the waiting node */ 349 if (debug) 350 syslog(LOG_INFO, "Sending original request to %s (%d bytes)", path, sz); 351 if (NgSendData(ds, ngc.ourhook, request, sz) == -1) { 352 syslog(LOG_ERR, "Cannot send original request to %s: %m", path); 353 _exit(EX_OSERR); 354 } 355 356 /* Then wait for a success indication */ 357 358 if (debug) 359 syslog(LOG_INFO, "Waiting for a SUCCESS reply %s", path); 360 361 do { 362 if (NgRecvMsg(cs, rep, sizeof msgbuf, NULL) < 0) { 363 syslog(LOG_ERR, "%s: Cannot receive a message: %m", path); 364 _exit(EX_OSERR); 365 } 366 367 if (rep->header.version != NG_VERSION) { 368 syslog(LOG_ERR, "%ld: Unexpected netgraph version, expected %ld", 369 (long)rep->header.version, (long)NG_VERSION); 370 _exit(EX_PROTOCOL); 371 } 372 373 if (rep->header.typecookie != NGM_PPPOE_COOKIE) { 374 syslog(LOG_INFO, "%ld: Unexpected netgraph cookie, expected %ld", 375 (long)rep->header.typecookie, (long)NGM_PPPOE_COOKIE); 376 continue; 377 } 378 379 switch (rep->header.cmd) { 380 case NGM_PPPOE_SET_FLAG: msg = "SET_FLAG"; break; 381 case NGM_PPPOE_CONNECT: msg = "CONNECT"; break; 382 case NGM_PPPOE_LISTEN: msg = "LISTEN"; break; 383 case NGM_PPPOE_OFFER: msg = "OFFER"; break; 384 case NGM_PPPOE_SUCCESS: msg = "SUCCESS"; break; 385 case NGM_PPPOE_FAIL: msg = "FAIL"; break; 386 case NGM_PPPOE_CLOSE: msg = "CLOSE"; break; 387 case NGM_PPPOE_GET_STATUS: msg = "GET_STATUS"; break; 388 default: 389 snprintf(unknown, sizeof unknown, "<%d>", (int)rep->header.cmd); 390 msg = unknown; 391 break; 392 } 393 394 switch (rep->header.cmd) { 395 case NGM_PPPOE_FAIL: 396 case NGM_PPPOE_CLOSE: 397 syslog(LOG_ERR, "Received NGM_PPPOE_%s (hook \"%s\")", 398 msg, sts->hook); 399 _exit(0); 400 } 401 402 syslog(LOG_INFO, "Received NGM_PPPOE_%s (hook \"%s\")", msg, sts->hook); 403 } while (rep->header.cmd != NGM_PPPOE_SUCCESS); 404 405 dup2(ds, STDIN_FILENO); 406 dup2(ds, STDOUT_FILENO); 407 close(ds); 408 close(cs); 409 410 setsid(); 411 syslog(LOG_INFO, "Executing: %s", exec); 412 execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", exec, (char *)NULL); 413 syslog(LOG_ERR, "execlp failed: %m"); 414 _exit(EX_OSFILE); 415 416 default: 417 wait(&ret); 418 errno = ret; 419 if (errno) 420 syslog(LOG_ERR, "Second fork failed: %m"); 421 break; 422 } 423 } 424 425 #ifndef NOKLDLOAD 426 static int 427 LoadModules(void) 428 { 429 const char *module[] = { "netgraph", "ng_socket", "ng_ether", "ng_pppoe" }; 430 int f; 431 432 for (f = 0; f < sizeof module / sizeof *module; f++) 433 if (modfind(module[f]) == -1 && kldload(module[f]) == -1) { 434 fprintf(stderr, "kldload: %s: %s\n", module[f], strerror(errno)); 435 return 0; 436 } 437 438 return 1; 439 } 440 #endif 441 442 static void 443 nglog(const char *fmt, ...) 444 { 445 char nfmt[256]; 446 va_list ap; 447 448 snprintf(nfmt, sizeof nfmt, "%s: %s", fmt, strerror(errno)); 449 va_start(ap, fmt); 450 vsyslog(LOG_INFO, nfmt, ap); 451 va_end(ap); 452 } 453 454 static void 455 nglogx(const char *fmt, ...) 456 { 457 va_list ap; 458 459 va_start(ap, fmt); 460 vsyslog(LOG_INFO, fmt, ap); 461 va_end(ap); 462 } 463 464 int 465 main(int argc, char **argv) 466 { 467 char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1]; 468 unsigned char response[1024]; 469 const char *label, *prog, *provider, *acname; 470 struct ngm_connect ngc; 471 struct sigaction act; 472 int ch, cs, ds, ret, optF, optd, optn, sz, f; 473 const char *pidfile; 474 475 prog = strrchr(argv[0], '/'); 476 prog = prog ? prog + 1 : argv[0]; 477 pidfile = NULL; 478 exec = NULL; 479 label = NULL; 480 acname = NULL; 481 provider = ""; 482 optF = optd = optn = 0; 483 484 while ((ch = getopt(argc, argv, "FP:a:de:l:n:p:")) != -1) { 485 switch (ch) { 486 case 'F': 487 optF = 1; 488 break; 489 490 case 'P': 491 pidfile = optarg; 492 break; 493 494 case 'a': 495 acname = optarg; 496 break; 497 498 case 'd': 499 optd = 1; 500 break; 501 502 case 'e': 503 exec = optarg; 504 break; 505 506 case 'l': 507 label = optarg; 508 break; 509 510 case 'n': 511 optn = 1; 512 NgSetDebug(atoi(optarg)); 513 break; 514 515 case 'p': 516 provider = optarg; 517 break; 518 519 default: 520 return usage(prog); 521 } 522 } 523 524 if (optind >= argc || optind + 2 < argc) 525 return usage(prog); 526 527 if (exec != NULL && label != NULL) 528 return usage(prog); 529 530 if (exec == NULL) { 531 if (label == NULL) 532 label = provider; 533 if (label == NULL) { 534 fprintf(stderr, "%s: Either a provider, a label or an exec command" 535 " must be given\n", prog); 536 return usage(prog); 537 } 538 exec = (char *)alloca(sizeof DEFAULT_EXEC_PREFIX + strlen(label)); 539 if (exec == NULL) { 540 fprintf(stderr, "%s: Cannot allocate %d bytes\n", prog, 541 (int)(sizeof DEFAULT_EXEC_PREFIX) + strlen(label)); 542 return EX_OSERR; 543 } 544 strcpy(exec, DEFAULT_EXEC_PREFIX); 545 strcpy(exec + sizeof DEFAULT_EXEC_PREFIX - 1, label); 546 } 547 548 if (acname == NULL) { 549 char *dot; 550 551 if (gethostname(hostname, sizeof hostname)) 552 strcpy(hostname, "localhost"); 553 else if ((dot = strchr(hostname, '.'))) 554 *dot = '\0'; 555 556 acname = hostname; 557 } 558 559 #ifndef NOKLDLOAD 560 if (!LoadModules()) 561 return EX_UNAVAILABLE; 562 #endif 563 564 /* Create a socket node */ 565 if (NgMkSockNode(NULL, &cs, &ds) == -1) { 566 perror("Cannot create netgraph socket node"); 567 return EX_CANTCREAT; 568 } 569 570 /* Connect it up (and fill in `ngc') */ 571 if ((ret = ConfigureNode(prog, argv[optind], provider, cs, ds, 572 optd, &ngc)) != 0) { 573 close(cs); 574 close(ds); 575 return ret; 576 } 577 578 if (!optF && daemon(1, 0) == -1) { 579 perror("daemon()"); 580 close(cs); 581 close(ds); 582 return EX_OSERR; 583 } 584 585 586 if (pidfile != NULL) { 587 FILE *fp; 588 589 if ((fp = fopen(pidfile, "w")) == NULL) { 590 perror(pidfile); 591 close(cs); 592 close(ds); 593 return EX_CANTCREAT; 594 } else { 595 fprintf(fp, "%d\n", (int)getpid()); 596 fclose(fp); 597 } 598 } 599 600 openlog(prog, LOG_PID | (optF ? LOG_PERROR : 0), LOG_DAEMON); 601 if (!optF && optn) 602 NgSetErrLog(nglog, nglogx); 603 604 memset(&act, '\0', sizeof act); 605 act.sa_handler = Farewell; 606 act.sa_flags = SA_RESETHAND; 607 sigemptyset(&act.sa_mask); 608 sigaction(SIGHUP, &act, NULL); 609 sigaction(SIGINT, &act, NULL); 610 sigaction(SIGQUIT, &act, NULL); 611 sigaction(SIGTERM, &act, NULL); 612 613 while (!ReceivedSignal) { 614 if (*provider) 615 syslog(LOG_INFO, "Listening as provider %s", provider); 616 else 617 syslog(LOG_INFO, "Listening"); 618 619 switch (sz = NgRecvData(ds, response, sizeof response, rhook)) { 620 case -1: 621 syslog(LOG_INFO, "NgRecvData: %m"); 622 break; 623 case 0: 624 syslog(LOG_INFO, "NgRecvData: socket closed"); 625 break; 626 default: 627 if (optd) { 628 char *dbuf, *ptr; 629 630 ptr = dbuf = alloca(sz * 2 + 1); 631 for (f = 0; f < sz; f++, ptr += 2) 632 sprintf(ptr, "%02x", (u_char)response[f]); 633 *ptr = '\0'; 634 syslog(LOG_INFO, "Got %d bytes of data: %s", sz, dbuf); 635 } 636 } 637 if (sz <= 0) { 638 ret = EX_UNAVAILABLE; 639 break; 640 } 641 Spawn(prog, acname, provider, exec, ngc, cs, ds, response, sz, optd); 642 } 643 644 if (pidfile) 645 remove(pidfile); 646 647 if (ReceivedSignal) { 648 syslog(LOG_INFO, "Received signal %d, exiting", ReceivedSignal); 649 650 signal(ReceivedSignal, SIG_DFL); 651 raise(ReceivedSignal); 652 653 /* NOTREACHED */ 654 655 ret = -ReceivedSignal; 656 } 657 658 return ret; 659 } 660