File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ parse_commandline(int argc, char **argv)
96
96
i = 0 ;
97
97
restartargv [i ++ ] = safe_strdup (argv [0 ]);
98
98
99
- while (-1 != (c = getopt (argc , argv , "c:hfd:sw:vx:i:" ))) {
99
+ while (-1 != (c = getopt (argc , argv , "c:hfd:sw:vx:i:a: " ))) {
100
100
101
101
skiponrestart = 0 ;
102
102
@@ -158,6 +158,15 @@ parse_commandline(int argc, char **argv)
158
158
}
159
159
break ;
160
160
161
+ case 'a' :
162
+ if (optarg ) {
163
+ free (config -> arp_table_path );
164
+ config -> arp_table_path = safe_strdup (optarg );
165
+ } else {
166
+ fprintf (stdout , "You must supply the path to the ARP table with -a!" );
167
+ exit (1 );
168
+ }
169
+ break ;
161
170
default :
162
171
usage ();
163
172
exit (1 );
Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ config_init(void)
197
197
config .ssl_certs = safe_strdup (DEFAULT_AUTHSERVSSLCERTPATH );
198
198
config .ssl_verify = DEFAULT_AUTHSERVSSLPEERVER ;
199
199
config .ssl_cipher_list = NULL ;
200
+ config .arp_table_path = safe_strdup (DEFAULT_ARPTABLE );
200
201
}
201
202
202
203
/**
Original file line number Diff line number Diff line change 71
71
#define DEFAULT_AUTHSERVSSLCERTPATH "/etc/ssl/certs/"
72
72
/** Note that DEFAULT_AUTHSERVSSLNOPEERVER must be 0 or 1, even if the config file syntax is yes or no */
73
73
#define DEFAULT_AUTHSERVSSLPEERVER 1 /* 0 means: Enable peer verification */
74
+ #define DEFAULT_ARPTABLE "/proc/net/arp"
74
75
/*@}*/
75
76
76
77
/*@{*/
@@ -185,6 +186,8 @@ typedef struct {
185
186
char * ssl_cipher_list ; /**< @brief List of SSL ciphers allowed. Optional. */
186
187
t_firewall_ruleset * rulesets ; /**< @brief firewall rules */
187
188
t_trusted_mac * trustedmaclist ; /**< @brief list of trusted macs */
189
+ char * arp_table_path ; /**< @brief Path to custom ARP table, formatted
190
+ like /proc/net/arp */
188
191
} s_config ;
189
192
190
193
/** @brief Get the current gateway configuration */
Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ fw_set_authup(void)
139
139
/* XXX DCY */
140
140
/**
141
141
* Get an IP's MAC address from the ARP cache.
142
- * Go through all the entries in /proc/net/arp until we find the requested
143
- * IP address and return the MAC address bound to it.
142
+ * Go through all the entries in config->arp_table_path until we find the
143
+ * requested IP address and return the MAC address bound to it.
144
144
* @todo Make this function portable (using shell scripts?)
145
145
*/
146
146
char *
@@ -150,8 +150,9 @@ arp_get(const char *req_ip)
150
150
char ip [16 ];
151
151
char mac [18 ];
152
152
char * reply ;
153
+ s_config * config = config_get_config ();
153
154
154
- if (!(proc = fopen ("/proc/net/arp" , "r" ))) {
155
+ if (!(proc = fopen (config -> arp_table_path , "r" ))) {
155
156
return NULL ;
156
157
}
157
158
You can’t perform that action at this time.
0 commit comments