| Line | |
|---|
| 1 | /* |
|---|
| 2 | * sputnik.c |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2007 Sebastian Gottschall <gottschall@dd-wrt.com> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or |
|---|
| 7 | * modify it under the terms of the GNU General Public License |
|---|
| 8 | * as published by the Free Software Foundation; either version 2 |
|---|
| 9 | * of the License. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 19 | * |
|---|
| 20 | * $Id: |
|---|
| 21 | */ |
|---|
| 22 | #ifdef HAVE_SPUTNIK_APD |
|---|
| 23 | #include <stdlib.h> |
|---|
| 24 | #include <bcmnvram.h> |
|---|
| 25 | #include <shutils.h> |
|---|
| 26 | #include <utils.h> |
|---|
| 27 | #include <syslog.h> |
|---|
| 28 | #include <signal.h> |
|---|
| 29 | |
|---|
| 30 | /* |
|---|
| 31 | * Sputnik APD Service Handling |
|---|
| 32 | */ |
|---|
| 33 | void start_sputnik(void) |
|---|
| 34 | { |
|---|
| 35 | int ret; |
|---|
| 36 | |
|---|
| 37 | // Only start if enabled |
|---|
| 38 | if (!nvram_invmatch("apd_enable", "0")) |
|---|
| 39 | return; |
|---|
| 40 | insmod("ipt_mark"); |
|---|
| 41 | insmod("ipt_mac"); |
|---|
| 42 | insmod("xt_mark"); |
|---|
| 43 | insmod("xt_mac"); |
|---|
| 44 | |
|---|
| 45 | ret = eval("sputnik"); |
|---|
| 46 | dd_syslog(LOG_INFO, "sputnik : sputnik daemon successfully started\n"); |
|---|
| 47 | cprintf("done\n"); |
|---|
| 48 | return; |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | void stop_sputnik(void) |
|---|
| 52 | { |
|---|
| 53 | int ret = 0; |
|---|
| 54 | |
|---|
| 55 | if (pidof("sputnik") > 0) { |
|---|
| 56 | dd_syslog(LOG_INFO, |
|---|
| 57 | "sputnik : sputnik daemon successfully stopped\n"); |
|---|
| 58 | ret = killall("sputnik", SIGTERM); |
|---|
| 59 | |
|---|
| 60 | cprintf("done\n"); |
|---|
| 61 | } |
|---|
| 62 | return; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | /* |
|---|
| 66 | * END Sputnik Service Handling |
|---|
| 67 | */ |
|---|
| 68 | |
|---|
| 69 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.