Home | History | Annotate | Download | only in netinet

Lines Matching refs:nat

8  * Simple FTP transparent proxy for in-kernel use.  For use with the NAT
227 ipf_p_ftp_new(void *arg, fr_info_t *fin, ap_session_t *aps, nat_t *nat)
236 nat = nat; /* LINT */
282 ipf_p_ftp_port(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
303 DT3(ftp_PORT_error_dlen, nat_t *, nat, ftpside_t *, f,
319 DT2(ftp_PORT_error_atoi_1, nat_t *, nat, ftpside_t *, f);
326 DT2(ftp_PORT_error_atoi_2, nat_t *, nat, ftpside_t *, f);
338 if (((nat->nat_dir == NAT_OUTBOUND) &&
339 (a1 != ntohl(nat->nat_osrcaddr))) ||
340 ((nat->nat_dir == NAT_INBOUND) &&
341 (a1 != ntohl(nat->nat_nsrcaddr)))) {
342 DT3(ftp_PORT_error_address, nat_t *, nat, ftpside_t *, f,
345 printf("ipf_p_ftp_port:%s != nat->nat_inip\n", "a1");
351 DT2(ftp_PORT_error_atoi_3, nat_t *, nat, ftpside_t *, f);
365 DT2(ftp_PORT_error_no_crlf, nat_t *, nat, ftpside_t *, f);
384 if (nat->nat_dir == NAT_INBOUND)
385 a1 = ntohl(nat->nat_ndstaddr);
400 DT3(ftp_PORT_error_inc, nat_t *, nat, ftpside_t *, f,
429 return ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, sp, inc);
434 ipf_p_ftp_addport(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
452 DT2(ftp_PORT_error_add_active, nat_t *, nat,
463 * Add skeleton NAT entry for connection which will come back the
472 DT3(ftp_PORT_error_port, nat_t *, nat, ftpinfo_t *, ftp,
487 fi.fin_src6 = nat->nat_ndst6;
488 fi.fin_dst6 = nat->nat_nsrc6;
490 if (nat->nat_v[0] == 6) {
497 * Add skeleton NAT entry for connection which will come back the
501 if (nat->nat_v[0] == 6) {
502 if (nat->nat_dir == NAT_OUTBOUND) {
504 nat->nat_pr[1],
505 &nat->nat_osrc6.in6,
506 &nat->nat_odst6.in6);
509 nat->nat_pr[0],
510 &nat->nat_odst6.in6,
511 &nat->nat_osrc6.in6);
516 if (nat->nat_dir == NAT_OUTBOUND) {
518 nat->nat_pr[1],
519 nat->nat_osrcip,
520 nat->nat_odstip);
523 nat->nat_pr[0],
524 nat->nat_odstip,
525 nat->nat_osrcip);
531 ipn = ipf_proxy_rule_rev(nat);
552 if (nat->nat_dir == NAT_INBOUND) {
562 if (nat->nat_v[0] == 6) {
584 fi.fin_dst6 = nat->nat_osrc6;
594 ipf_p_ftp_client(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
650 inc = ipf_p_ftp_port(softf, fin, ip, nat, ftp, dlen);
654 inc = ipf_p_ftp_eprt(softf, fin, ip, nat, ftp, dlen);
658 inc = ipf_p_ftp_port(softf, fin, ip, nat, ftp, dlen);
673 ipf_p_ftp_pasv(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
685 DT2(ftp_PASV_error_state, nat_t *, nat, ftpinfo_t *, ftp);
699 DT3(ftp_PASV_error_short, nat_t *, nat, ftpinfo_t *, ftp,
707 DT2(ftp_PASV_error_string, nat_t *, nat, ftpinfo_t *, ftp);
732 DT2(ftp_PASV_error_atoi_1, nat_t *, nat, ftpside_t *, f);
739 DT2(ftp_PASV_error_atoi_2, nat_t *, nat, ftpside_t *, f);
752 if (((nat->nat_dir == NAT_INBOUND) &&
753 (a1 != ntohl(nat->nat_ndstaddr))) ||
754 ((nat->nat_dir == NAT_OUTBOUND) &&
755 (a1 != ntohl(nat->nat_odstaddr)))) {
756 DT3(ftp_PASV_error_address, nat_t *, nat, ftpside_t *, f,
759 printf("ipf_p_ftp_pasv:%s != nat->nat_oip\n", "a1");
765 DT2(ftp_PASV_error_atoi_3, nat_t *, nat, ftpside_t *, f);
793 if (nat->nat_dir == NAT_INBOUND) {
794 data_ip = nat->nat_odstaddr;
807 return ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, (a5 << 8 | a6),
813 nat_t *nat, ftpinfo_t *ftp, u_int port, char *newmsg, char *s)
847 DT3(ftp_PASV_error_inc, nat_t *, nat, ftpside_t *, f,
855 ipn = ipf_proxy_rule_fwd(nat);
861 * Add skeleton NAT entry for connection which will come back the
875 fi.fin_src6 = nat->nat_osrc6;
876 fi.fin_dst6 = nat->nat_odst6;
886 if (nat->nat_v[0] == 6) {
889 nflags, nat->nat_dir);
893 nflags, nat->nat_dir);
907 if (nat->nat_dir == NAT_INBOUND) {
908 if (nat->nat_v[0] == 6) {
910 fi.fin_dst6 = nat->nat_ndst6;
913 fi.fin_daddr = nat->nat_ndstaddr;
937 if (nat->nat_v[0] == 6) {
953 ipf_p_ftp_server(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
975 inc = ipf_p_ftp_pasv(softf, fin, ip, nat, ftp, dlen);
977 inc = ipf_p_ftp_epsv(softf, fin, ip, nat, ftp, dlen);
985 inc = ipf_p_ftp_pasv(softf, fin, ip, nat, ftp, dlen);
987 inc = ipf_p_ftp_epsv(softf, fin, ip, nat, ftp, dlen);
1226 ipf_p_ftp_process(ipf_ftp_softc_t *softf, fr_info_t *fin, nat_t *nat,
1267 aps = nat->nat_aps;
1486 nat, ftp, len);
1489 nat, ftp, len);
1565 ipf_p_ftp_out(void *arg, fr_info_t *fin, ap_session_t *aps, nat_t *nat)
1575 rev = (nat->nat_dir == NAT_OUTBOUND) ? 0 : 1;
1579 return ipf_p_ftp_process(softf, fin, nat, ftp, rev);
1584 ipf_p_ftp_in(void *arg, fr_info_t *fin, ap_session_t *aps, nat_t *nat)
1594 rev = (nat->nat_dir == NAT_OUTBOUND) ? 0 : 1;
1598 return ipf_p_ftp_process(softf, fin, nat, ftp, 1 - rev);
1634 ipf_p_ftp_eprt(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
1659 if (f->ftps_rptr[6] == '1' && nat->nat_v[0] == 4)
1660 return ipf_p_ftp_eprt4(softf, fin, ip, nat, ftp, dlen);
1662 if (f->ftps_rptr[6] == '2' && nat->nat_v[0] == 6)
1663 return ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen);
1671 ipf_p_ftp_eprt4(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
1764 if (nat->nat_dir == NAT_INBOUND)
1765 a1 = ntohl(nat->nat_odstaddr);
1809 return ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, port, inc);
1814 ipf_p_ftp_epsv(ipf_ftp_softc_t *softf, fr_info_t *fin, ip_t *ip, nat_t *nat,
1880 return ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, (u_int)ap,
1887 nat_t *nat, ftpinfo_t *ftp, int dlen)
2066 return ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, port, inc);