Ticket #312: openvpn_dhcp.patch

File openvpn_dhcp.patch, 2.1 KB (added by tripolar, 9 years ago)

patch to add a possibility to deactive the modification of dhcp packets

  • src/openvpn/forward.c

    diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
    index 024cd58..c65afd3 100644
    a b process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) 
    10171017  if (!c->options.passtos)
    10181018    flags &= ~PIPV4_PASSTOS;
    10191019#endif
     1020#ifdef ENABLE_EXTRACT_DHCP_ROUTER
    10201021  if (!c->options.route_gateway_via_dhcp)
    10211022    flags &= ~PIPV4_EXTRACT_DHCP_ROUTER;
    1022 
     1023#endif
    10231024  if (buf->len > 0)
    10241025    {
    10251026      /*
    process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) 
    10531054                  client_nat_transform (c->options.client_nat, &ipbuf, direction);
    10541055                }
    10551056#endif
     1057#ifdef ENABLE_EXTRACT_DHCP_ROUTER
    10561058              /* possibly extract a DHCP router message */
    10571059              if (flags & PIPV4_EXTRACT_DHCP_ROUTER)
    10581060                {
    process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) 
    10601062                  if (dhcp_router)
    10611063                    route_list_add_vpn_gateway (c->c1.route_list, c->c2.es, dhcp_router);
    10621064                }
     1065#endif
    10631066            }
    10641067          else if (is_ipv6 (TUNNEL_TYPE (c->c1.tuntap), &ipbuf))
    10651068            {
  • src/openvpn/options.c

    diff --git a/src/openvpn/options.c b/src/openvpn/options.c
    index 23af272..8cfd887 100644
    a b show_settings (const struct options *o) 
    15211521  SHOW_INT (route_delay_window);
    15221522  SHOW_BOOL (route_delay_defined);
    15231523  SHOW_BOOL (route_nopull);
     1524#ifdef ENABLE_EXTRACT_DHCP_ROUTER
    15241525  SHOW_BOOL (route_gateway_via_dhcp);
     1526#endif
    15251527  SHOW_INT (max_routes);
    15261528  SHOW_BOOL (allow_pull_fqdn);
    15271529  if (o->routes)
    add_option (struct options *options, 
    51745176      VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS);
    51755177      if (streq (p[1], "dhcp"))
    51765178        {
     5179#ifdef ENABLE_EXTRACT_DHCP_ROUTER
    51775180          options->route_gateway_via_dhcp = true;
     5181#endif
    51785182        }
    51795183      else
    51805184        {
  • src/openvpn/syshead.h

    diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
    index 4db29cc..4f85023 100644
    a b socket_defined (const socket_descriptor_t sd) 
    720720#define ENABLE_CLIENT_NAT
    721721
    722722/*
     723 * Do we extract DHCP routers?
     724 */
     725#define ENABLE_EXTRACT_DHCP_ROUTER
     726
     727/*
    723728 * Enable --memstats option
    724729 */
    725730#ifdef TARGET_LINUX