nat_cmd.c (de97d73d116804257908ce2b4eda643d0497f9ef) | nat_cmd.c (d397408818fbfa179246fb327659e3fb29ffff31) |
---|---|
1/*- 2 * Copyright (c) 2001 Charles Mott <cm@linktel.net> 3 * Brian Somers <brian@Awfulhak.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 201 unchanged lines hidden (view full) --- 210 error = StrToAddr(arg->argv[arg->argn], &localaddr); 211 if (error) { 212 prompt_Printf(arg->prompt, "address redirect: invalid local address\n"); 213 return 1; 214 } 215 error = StrToAddr(arg->argv[arg->argn+1], &aliasaddr); 216 if (error) { 217 prompt_Printf(arg->prompt, "address redirect: invalid alias address\n"); | 1/*- 2 * Copyright (c) 2001 Charles Mott <cm@linktel.net> 3 * Brian Somers <brian@Awfulhak.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 201 unchanged lines hidden (view full) --- 210 error = StrToAddr(arg->argv[arg->argn], &localaddr); 211 if (error) { 212 prompt_Printf(arg->prompt, "address redirect: invalid local address\n"); 213 return 1; 214 } 215 error = StrToAddr(arg->argv[arg->argn+1], &aliasaddr); 216 if (error) { 217 prompt_Printf(arg->prompt, "address redirect: invalid alias address\n"); |
218 prompt_Printf(arg->prompt, "Usage: nat %s %s\n", arg->cmd->name, | 218 prompt_Printf(arg->prompt, "usage: nat %s %s\n", arg->cmd->name, |
219 arg->cmd->syntax); 220 return 1; 221 } 222 link = PacketAliasRedirectAddr(localaddr, aliasaddr); 223 if (link == NULL) { 224 prompt_Printf(arg->prompt, "address redirect: packet aliasing" 225 " engine error\n"); | 219 arg->cmd->syntax); 220 return 1; 221 } 222 link = PacketAliasRedirectAddr(localaddr, aliasaddr); 223 if (link == NULL) { 224 prompt_Printf(arg->prompt, "address redirect: packet aliasing" 225 " engine error\n"); |
226 prompt_Printf(arg->prompt, "Usage: nat %s %s\n", arg->cmd->name, | 226 prompt_Printf(arg->prompt, "usage: nat %s %s\n", arg->cmd->name, |
227 arg->cmd->syntax); 228 } 229 } else 230 return -1; 231 232 return 0; 233} 234 --- 29 unchanged lines hidden (view full) --- 264 prompt_Printf(arg->prompt, "proto redirect: invalid src address\n"); 265 return 1; 266 } 267 268 if (arg->argc >= arg->argn + 3) { 269 error = StrToAddr(arg->argv[arg->argn + 2], &publicIP); 270 if (error) { 271 prompt_Printf(arg->prompt, "proto redirect: invalid alias address\n"); | 227 arg->cmd->syntax); 228 } 229 } else 230 return -1; 231 232 return 0; 233} 234 --- 29 unchanged lines hidden (view full) --- 264 prompt_Printf(arg->prompt, "proto redirect: invalid src address\n"); 265 return 1; 266 } 267 268 if (arg->argc >= arg->argn + 3) { 269 error = StrToAddr(arg->argv[arg->argn + 2], &publicIP); 270 if (error) { 271 prompt_Printf(arg->prompt, "proto redirect: invalid alias address\n"); |
272 prompt_Printf(arg->prompt, "Usage: nat %s %s\n", arg->cmd->name, | 272 prompt_Printf(arg->prompt, "usage: nat %s %s\n", arg->cmd->name, |
273 arg->cmd->syntax); 274 return 1; 275 } 276 } else 277 publicIP.s_addr = INADDR_ANY; 278 279 if (arg->argc == arg->argn + 4) { 280 error = StrToAddr(arg->argv[arg->argn + 2], &remoteIP); 281 if (error) { 282 prompt_Printf(arg->prompt, "proto redirect: invalid dst address\n"); | 273 arg->cmd->syntax); 274 return 1; 275 } 276 } else 277 publicIP.s_addr = INADDR_ANY; 278 279 if (arg->argc == arg->argn + 4) { 280 error = StrToAddr(arg->argv[arg->argn + 2], &remoteIP); 281 if (error) { 282 prompt_Printf(arg->prompt, "proto redirect: invalid dst address\n"); |
283 prompt_Printf(arg->prompt, "Usage: nat %s %s\n", arg->cmd->name, | 283 prompt_Printf(arg->prompt, "usage: nat %s %s\n", arg->cmd->name, |
284 arg->cmd->syntax); 285 return 1; 286 } 287 } else 288 remoteIP.s_addr = INADDR_ANY; 289 290 link = PacketAliasRedirectProto(localIP, remoteIP, publicIP, pe->p_proto); 291 if (link == NULL) { 292 prompt_Printf(arg->prompt, "proto redirect: packet aliasing" 293 " engine error\n"); | 284 arg->cmd->syntax); 285 return 1; 286 } 287 } else 288 remoteIP.s_addr = INADDR_ANY; 289 290 link = PacketAliasRedirectProto(localIP, remoteIP, publicIP, pe->p_proto); 291 if (link == NULL) { 292 prompt_Printf(arg->prompt, "proto redirect: packet aliasing" 293 " engine error\n"); |
294 prompt_Printf(arg->prompt, "Usage: nat %s %s\n", arg->cmd->name, | 294 prompt_Printf(arg->prompt, "usage: nat %s %s\n", arg->cmd->name, |
295 arg->cmd->syntax); 296 } 297 } else 298 return -1; 299 300 return 0; 301} 302 --- 268 unchanged lines hidden --- | 295 arg->cmd->syntax); 296 } 297 } else 298 return -1; 299 300 return 0; 301} 302 --- 268 unchanged lines hidden --- |