Hi Roopa,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/Roopa-Prabhu/vxlan-a-few-minor-cleanups/20181130-184658
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/net/vxlan.c: In function 'vxlan_nl2conf':
>> drivers/net/vxlan.c:3527:3: error: expected '}' before 'else'
      else {
      ^~~~

vim +3527 drivers/net/vxlan.c

  3376  
  3377  static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
  3378                           struct net_device *dev, struct vxlan_config 
*conf,
  3379                           bool changelink, struct netlink_ext_ack 
*extack)
  3380  {
  3381          struct vxlan_dev *vxlan = netdev_priv(dev);
  3382  
  3383          memset(conf, 0, sizeof(*conf));
  3384  
  3385          /* if changelink operation, start with old existing cfg */
  3386          if (changelink)
  3387                  memcpy(conf, &vxlan->cfg, sizeof(*conf));
  3388  
  3389          if (data[IFLA_VXLAN_ID]) {
  3390                  __be32 vni = 
cpu_to_be32(nla_get_u32(data[IFLA_VXLAN_ID]));
  3391  
  3392                  if (changelink && (vni != conf->vni)) {
  3393                          NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_ID],
  3394                                              "Cannot change vni");
  3395                          return -EOPNOTSUPP;
  3396                  }
  3397                  conf->vni = 
cpu_to_be32(nla_get_u32(data[IFLA_VXLAN_ID]));
  3398          }
  3399  
  3400          if (data[IFLA_VXLAN_GROUP]) {
  3401                  if (changelink && (conf->remote_ip.sa.sa_family != 
AF_INET)) {
  3402                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_GROUP],
  3403                                              "New group addr family does 
not match old group");
  3404                          return -EOPNOTSUPP;
  3405                  }
  3406                  conf->remote_ip.sin.sin_addr.s_addr = 
nla_get_in_addr(data[IFLA_VXLAN_GROUP]);
  3407                  conf->remote_ip.sa.sa_family = AF_INET;
  3408          } else if (data[IFLA_VXLAN_GROUP6]) {
  3409                  if (!IS_ENABLED(CONFIG_IPV6)) {
  3410                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_GROUP6],
  3411                                              "IPv6 support not enabled 
in the kernel");
  3412                          return -EPFNOSUPPORT;
  3413                  }
  3414  
  3415                  if (changelink && (conf->remote_ip.sa.sa_family != 
AF_INET6)) {
  3416                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_GROUP6],
  3417                                              "New group addr family does 
not match old group");
  3418                          return -EOPNOTSUPP;
  3419                  }
  3420  
  3421                  conf->remote_ip.sin6.sin6_addr = 
nla_get_in6_addr(data[IFLA_VXLAN_GROUP6]);
  3422                  conf->remote_ip.sa.sa_family = AF_INET6;
  3423          }
  3424  
  3425          if (data[IFLA_VXLAN_LOCAL]) {
  3426                  if (changelink && (conf->saddr.sa.sa_family != 
AF_INET)) {
  3427                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_LOCAL],
  3428                                              "New local addr family does 
not match old");
  3429                          return -EOPNOTSUPP;
  3430                  }
  3431  
  3432                  conf->saddr.sin.sin_addr.s_addr = 
nla_get_in_addr(data[IFLA_VXLAN_LOCAL]);
  3433                  conf->saddr.sa.sa_family = AF_INET;
  3434          } else if (data[IFLA_VXLAN_LOCAL6]) {
  3435                  if (!IS_ENABLED(CONFIG_IPV6)) {
  3436                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_LOCAL6],
  3437                                              "IPv6 support not enabled 
in the kernel");
  3438                          return -EPFNOSUPPORT;
  3439                  }
  3440  
  3441                  if (changelink && (conf->saddr.sa.sa_family != 
AF_INET6)) {
  3442                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_LOCAL6],
  3443                                              "New local6 addr family 
does not match old");
  3444                          return -EOPNOTSUPP;
  3445                  }
  3446  
  3447                  /* TODO: respect scope id */
  3448                  conf->saddr.sin6.sin6_addr = 
nla_get_in6_addr(data[IFLA_VXLAN_LOCAL6]);
  3449                  conf->saddr.sa.sa_family = AF_INET6;
  3450          }
  3451  
  3452          if (data[IFLA_VXLAN_LINK])
  3453                  conf->remote_ifindex = 
nla_get_u32(data[IFLA_VXLAN_LINK]);
  3454  
  3455          if (data[IFLA_VXLAN_TOS])
  3456                  conf->tos  = nla_get_u8(data[IFLA_VXLAN_TOS]);
  3457  
  3458          if (data[IFLA_VXLAN_TTL])
  3459                  conf->ttl = nla_get_u8(data[IFLA_VXLAN_TTL]);
  3460  
  3461          if (data[IFLA_VXLAN_TTL_INHERIT])
  3462                  conf->flags |= VXLAN_F_TTL_INHERIT;
  3463  
  3464          if (data[IFLA_VXLAN_LABEL])
  3465                  conf->label = nla_get_be32(data[IFLA_VXLAN_LABEL]) &
  3466                               IPV6_FLOWLABEL_MASK;
  3467  
  3468          if (data[IFLA_VXLAN_LEARNING]) {
  3469                  if (nla_get_u8(data[IFLA_VXLAN_LEARNING]))
  3470                          conf->flags |= VXLAN_F_LEARN;
  3471                  else
  3472                          conf->flags &= ~VXLAN_F_LEARN;
  3473          } else if (!changelink) {
  3474                  /* default to learn on a new device */
  3475                  conf->flags |= VXLAN_F_LEARN;
  3476          }
  3477  
  3478          if (data[IFLA_VXLAN_AGEING])
  3479                  conf->age_interval = 
nla_get_u32(data[IFLA_VXLAN_AGEING]);
  3480  
  3481          if (data[IFLA_VXLAN_PROXY]) {
  3482                  if (nla_get_u8(data[IFLA_VXLAN_PROXY]))
  3483                          conf->flags |= VXLAN_F_PROXY;
  3484          }
  3485  
  3486          if (data[IFLA_VXLAN_RSC]) {
  3487                  if (nla_get_u8(data[IFLA_VXLAN_RSC]))
  3488                          conf->flags |= VXLAN_F_RSC;
  3489          }
  3490  
  3491          if (data[IFLA_VXLAN_L2MISS]) {
  3492                  if (nla_get_u8(data[IFLA_VXLAN_L2MISS]))
  3493                          conf->flags |= VXLAN_F_L2MISS;
  3494          }
  3495  
  3496          if (data[IFLA_VXLAN_L3MISS]) {
  3497                  if (nla_get_u8(data[IFLA_VXLAN_L3MISS]))
  3498                          conf->flags |= VXLAN_F_L3MISS;
  3499          }
  3500  
  3501          if (data[IFLA_VXLAN_LIMIT]) {
  3502                  if (changelink) {
  3503                          NL_SET_ERR_MSG_ATTR(extack, 
tb[IFLA_VXLAN_LIMIT],
  3504                                              "Cannot change limit");
  3505                          return -EOPNOTSUPP;
  3506                  }
  3507                  conf->addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]);
  3508          }
  3509  
  3510          if (data[IFLA_VXLAN_COLLECT_METADATA]) {
  3511                  if (changelink) {
  3512                          NL_SET_ERR_MSG_ATTR(extack,
  3513                                              
tb[IFLA_VXLAN_COLLECT_METADATA],
  3514                                              "Cannot change metadata 
flag");
  3515                          return -EOPNOTSUPP;
  3516                  }
  3517                  if (nla_get_u8(data[IFLA_VXLAN_COLLECT_METADATA]))
  3518                          conf->flags |= VXLAN_F_COLLECT_METADATA;
  3519          }
  3520  
  3521          if (data[IFLA_VXLAN_PORT_RANGE]) {
  3522                  if (!changelink) {
  3523                          const struct ifla_vxlan_port_range *p
  3524                                  = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
  3525                          conf->port_min = ntohs(p->low);
  3526                          conf->port_max = ntohs(p->high);
> 3527                  else {
  3528                          NL_SET_ERR_MSG_ATTR(extack,
  3529                                              tb[IFLA_VXLAN_PORT_RANGE],
  3530                                              "Cannot change port range");
  3531                          return -EOPNOTSUPP;
  3532                  }
  3533          }
  3534  
  3535          if (data[IFLA_VXLAN_PORT]) {
  3536                  if (changelink) {
  3537                          NL_SET_ERR_MSG_ATTR(extack,
  3538                                              tb[IFLA_VXLAN_PORT],
  3539                                              "Cannot change port");
  3540                          return -EOPNOTSUPP;
  3541                  }
  3542                  conf->dst_port = nla_get_be16(data[IFLA_VXLAN_PORT]);
  3543          }
  3544  
  3545          if (data[IFLA_VXLAN_UDP_CSUM]) {
  3546                  if (changelink) {
  3547                          NL_SET_ERR_MSG_ATTR(extack,
  3548                                              tb[IFLA_VXLAN_UDP_CSUM],
  3549                                              "Cannot change udp csum");
  3550                          return -EOPNOTSUPP;
  3551                  }
  3552                  if (!nla_get_u8(data[IFLA_VXLAN_UDP_CSUM]))
  3553                          conf->flags |= VXLAN_F_UDP_ZERO_CSUM_TX;
  3554          }
  3555  
  3556          if (data[IFLA_VXLAN_UDP_ZERO_CSUM6_TX]) {
  3557                  if (nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_TX]))
  3558                          conf->flags |= VXLAN_F_UDP_ZERO_CSUM6_TX;
  3559          }
  3560  
  3561          if (data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX]) {
  3562                  if (nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX]))
  3563                          conf->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX;
  3564          }
  3565  
  3566          if (data[IFLA_VXLAN_REMCSUM_TX]) {
  3567                  if (nla_get_u8(data[IFLA_VXLAN_REMCSUM_TX]))
  3568                          conf->flags |= VXLAN_F_REMCSUM_TX;
  3569          }
  3570  
  3571          if (data[IFLA_VXLAN_REMCSUM_RX]) {
  3572                  if (nla_get_u8(data[IFLA_VXLAN_REMCSUM_RX]))
  3573                          conf->flags |= VXLAN_F_REMCSUM_RX;
  3574          }
  3575  
  3576          if (data[IFLA_VXLAN_GBP])
  3577                  conf->flags |= VXLAN_F_GBP;
  3578  
  3579          if (data[IFLA_VXLAN_GPE])
  3580                  conf->flags |= VXLAN_F_GPE;
  3581  
  3582          if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL])
  3583                  conf->flags |= VXLAN_F_REMCSUM_NOPARTIAL;
  3584  
  3585          if (tb[IFLA_MTU]) {
  3586                  if (changelink) {
  3587                          NL_SET_ERR_MSG_ATTR(extack,
  3588                                              tb[IFLA_MTU],
  3589                                              "Cannot change mtu");
  3590                          return -EOPNOTSUPP;
  3591                  }
  3592                  conf->mtu = nla_get_u32(tb[IFLA_MTU]);
  3593          }
  3594  
  3595          if (data[IFLA_VXLAN_DF])
  3596                  conf->df = nla_get_u8(data[IFLA_VXLAN_DF]);
  3597  
  3598          return 0;
  3599  }
  3600  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to