gre: Always set TTL on outer packet to 64.
[openvswitch] / lib / netdev-linux.c
index 6d46b09e923a0c7f8aecee416cdcfad26f2e626e..daf00a480ea6f925f5b091ae447a85f0482c9d5b 100644 (file)
@@ -216,7 +216,7 @@ netdev_linux_wait(void)
 
 static void
 netdev_linux_cache_cb(const struct rtnetlink_change *change,
-                      void *aux UNUSED)
+                      void *aux OVS_UNUSED)
 {
     struct netdev_dev_linux *dev;
     if (change) {
@@ -242,8 +242,8 @@ netdev_linux_cache_cb(const struct rtnetlink_change *change,
 /* The arguments are marked as unused to prevent warnings on platforms where
  * the Netlink interface isn't supported. */
 static int
-setup_gre_netlink(const char *name UNUSED, struct gre_config *config UNUSED,
-                  bool create UNUSED)
+setup_gre_netlink(const char *name OVS_UNUSED,
+                  struct gre_config *config OVS_UNUSED, bool create OVS_UNUSED)
 {
 #ifdef GRE_IOCTL_ONLY
     return EOPNOTSUPP;
@@ -316,7 +316,7 @@ setup_gre_netlink(const char *name UNUSED, struct gre_config *config UNUSED,
     nl_msg_put_u32(&request, IFLA_GRE_LOCAL, config->local_ip);
     nl_msg_put_u32(&request, IFLA_GRE_REMOTE, config->remote_ip);
     nl_msg_put_u8(&request, IFLA_GRE_PMTUDISC, pmtudisc);
-    nl_msg_put_u8(&request, IFLA_GRE_TTL, 0);
+    nl_msg_put_u8(&request, IFLA_GRE_TTL, IPDEFTTL);
     nl_msg_put_u8(&request, IFLA_GRE_TOS, 0);
 
     info_data_hdr->nla_len = (char *)ofpbuf_tail(&request)
@@ -356,6 +356,7 @@ setup_gre_ioctl(const char *name, struct gre_config *config, bool create)
     p.iph.protocol = IPPROTO_GRE;
     p.iph.saddr = config->local_ip;
     p.iph.daddr = config->remote_ip;
+    p.iph.ttl = IPDEFTTL;
 
     if (config->have_in_key) {
         p.i_flags |= GRE_KEY;
@@ -397,7 +398,7 @@ setup_gre_ioctl(const char *name, struct gre_config *config, bool create)
 /* The arguments are marked as unused to prevent warnings on platforms where
  * the Netlink interface isn't supported. */
 static bool
-check_gre_device_netlink(const char *name UNUSED)
+check_gre_device_netlink(const char *name OVS_UNUSED)
 {
 #ifdef GRE_IOCTL_ONLY
     return false;
@@ -569,7 +570,7 @@ error:
 
 /* Creates the netdev device of 'type' with 'name'. */
 static int
-netdev_linux_create_system(const char *name, const char *type UNUSED,
+netdev_linux_create_system(const char *name, const char *type OVS_UNUSED,
                     const struct shash *args, struct netdev_dev **netdev_devp)
 {
     struct netdev_dev_linux *netdev_dev;
@@ -602,7 +603,7 @@ netdev_linux_create_system(const char *name, const char *type UNUSED,
  * buffers, across all readers.  Therefore once data is read it will
  * be unavailable to other reads for tap devices. */
 static int
-netdev_linux_create_tap(const char *name, const char *type UNUSED,
+netdev_linux_create_tap(const char *name, const char *type OVS_UNUSED,
                     const struct shash *args, struct netdev_dev **netdev_devp)
 {
     struct netdev_dev_linux *netdev_dev;
@@ -669,7 +670,7 @@ if_up(const char *name)
 }
 
 static int
-netdev_linux_create_gre(const char *name, const char *type UNUSED,
+netdev_linux_create_gre(const char *name, const char *type OVS_UNUSED,
                     const struct shash *args, struct netdev_dev **netdev_devp)
 {
     struct netdev_dev_linux *netdev_dev;
@@ -708,7 +709,7 @@ netdev_linux_reconfigure_gre(struct netdev_dev *netdev_dev_,
 /* The arguments are marked as unused to prevent warnings on platforms where
  * the Netlink interface isn't supported. */
 static int
-destroy_gre_netlink(const char *name UNUSED)
+destroy_gre_netlink(const char *name OVS_UNUSED)
 {
 #ifdef GRE_IOCTL_ONLY
     return EOPNOTSUPP;
@@ -1707,7 +1708,7 @@ do_set_addr(struct netdev *netdev,
 
 /* Adds 'router' as a default IP gateway. */
 static int
-netdev_linux_add_router(struct netdev *netdev UNUSED, struct in_addr router)
+netdev_linux_add_router(struct netdev *netdev OVS_UNUSED, struct in_addr router)
 {
     struct in_addr any = { INADDR_ANY };
     struct rtentry rt;
@@ -1874,7 +1875,7 @@ poll_notify(struct list *list)
 
 static void
 netdev_linux_poll_cb(const struct rtnetlink_change *change,
-                     void *aux UNUSED)
+                     void *aux OVS_UNUSED)
 {
     if (change) {
         struct list *list = shash_find_data(&netdev_linux_notifiers,