AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:
CFG:
PT:0
S:andy.sharp@lsi.com
RQ:
SSV:mhbs.lsil.com
NSV:
SSH:
R:<Ed.Kwan@lsi.com>,<Pravin.Shedage@lsi.com>,<Anurag.Agarwal@lsi.com>,<Yogesh.Sawant@lsi.com>,<Brian.Nguyen@lsi.com>
MAID:2
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/LSI/INBOX	0	2B044E14371DA244B71F8BF2514563F53BB0FB61@cosmail03.lsi.com
X-Sylpheed-End-Special-Headers: 1
Date: Tue, 9 Mar 2010 11:08:39 -0800
From: Andrew Sharp <andy.sharp@lsi.com>
To: "Kwan, Ed" <Ed.Kwan@lsi.com>
Cc: "Shedage, Pravin" <Pravin.Shedage@lsi.com>, "Agarwal, Anurag"
 <Anurag.Agarwal@lsi.com>, "Sawant, Yogesh" <Yogesh.Sawant@lsi.com>,
 "Nguyen, Brian" <Brian.Nguyen@lsi.com>
Subject: Re: Please review the code regarding defect TED00028036.
Message-ID: <20100309110839.28625f19@ripper.onstor.net>
In-Reply-To: <2B044E14371DA244B71F8BF2514563F53BB0FB61@cosmail03.lsi.com>
References: <04FB0DCDF7702C409F7E481C74E6A9BF020CF8B16F@inbmail02.lsi.com>
	<2B044E14371DA244B71F8BF2514563F53BAB64B2@cosmail03.lsi.com>
	<04FB0DCDF7702C409F7E481C74E6A9BF020CF8B173@inbmail02.lsi.com>
	<2B044E14371DA244B71F8BF2514563F53BB0FB61@cosmail03.lsi.com>
Organization: LSI
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

I think it's OK to allow it there, it's just another way of saying
"I mean this individual host ... only".  

On Tue, 9 Mar 2010 11:57:28 -0700 "Kwan, Ed" <Ed.Kwan@lsi.com> wrote:

> I looked at the "/32" mask comments again, and I noticed nfxsh does
> not allow that in other commands:
> 
>     473 static int32
>     474 intf_parseIpAddrs(char *ipList,
>     475                   uint32 *modifyReqLen,
>     476                   vsd_modifyVintfReq_t **modifyReq,
>     477                   boolean add)
>     478 {
>     ...
>     527         if (add == TRUE) {
>     528             if (net_atoipmask(srcBuf, &ipAddr, &mask) !=
> NFX_OK) { 529                 printf("Incorrect ip/mask_len pair %s, "
>     530                        "format A.B.C.D/masklen\n",
>     531                        srcBuf);
>     532                 return NFX_ERR;
>     533             }
>     534
>     535             /* Catch obvious errors
>     536              */
>     537             if (!ipAddr ||
>     538                 ipAddr == 0xffffffff ||
>     539                 !mask ||
>     540                 mask == 0xffffffff ||
>     541                 ((ipAddr & ~mask) == 0) ||
>     542                 ((ipAddr & ~mask) == (0xffffffff & ~mask))) {
>     543                 printf("IP/Mask pair %s is not valid\n",
> srcBuf); 544                 return NFX_ERR;
>     545             }
> 
> So to be consistent, I think you are correct and we should not allow
> it in the "nfs share" commands.
> 
> 
> From: Kwan, Ed
> Sent: Monday, March 08, 2010 11:23 PM
> To: Shedage, Pravin
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian; Sharp, Andy
> Subject: RE: Please review the code regarding defect TED00028036.
> 
> 
> Comments inline/below.
> 
> 
> 
> -----Original Message-----
> From: Shedage, Pravin
> Sent: Thursday, March 04, 2010 9:46 PM
> To: Kwan, Ed
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian; Sharp, Andy
> Subject: Please review the code regarding defect TED00028036.
> 
> 
> 
> Hi Ed,
> 
> 
> 
>  defect TED00028036 :
> 
> 
> 
> * As per the below example in defect 12.912/32 is considered to be
> invalid IPAddress but it seems to valid.
> 
>    10:50:32 g3r5 G3R5-VS6 diag> nfs show all
> 
>    State: Enabled    Share path: /vol6a
> 
>    Option: rw, client list:
> 
>   12.912/32
> 
>   Option: no_root_squash, client list:
> 
>   12.12/32
> 
> 
> 
> [EDK] 12.912 is equivalent to 12.0.3.144 (according to ping), so yes,
> it seems valid.
> 
> 
> 
> 
> 
> 
> 
> * inet_aton() handles validation for IPAddress, following IPAddress
> are invalid client IPAddresses
> 
>     127.0.0.1
> 
>     255.255.255.255
> 
>     0.0.0.0
> 
>   - I have handled these validations.
> 
> 
> 
> [EDK] Sounds reasonable.
> 
> 
> 
> 
> 
> * Now /32 is not valid subnet mask & this is default behaviour to
> add /32 subnet in ipaddress.
> 
>   - this subnet mask is valid only in classful subnetting, now this
> is not used anymore ...
> 
>   - In CIDR /32 is 255.255.255.255 means all bits in ipaddress are
> used for networks
> 
>     So /32 subnet mask is not allowed. I think it's a bug...
> 
> 
> 
>       g5r6 TEST diag> nfs show all
> 
>       State: Enabled    Share path: /vol_std_g5r6_test
> 
>       Option: rw, client list:
> 
>       127.0.0.15/32
> 
>       Option: no_root_squash, client list:
> 
>       c12r15-rhel4.onstor.lab
> 
> 
> 
>       g5r6 TEST diag>
> 
> 
> 
> 
> 
> [EDK] The mask /32 is certainly not very useable, but at least my
> Linux box thinks it is legal:
> 
> [root@edk-linux edk]# /usr/sbin/exportfs
> 
> [root@edk-linux edk]# /usr/sbin/exportfs 10.0.0.123/32:/tmp
> 
> [root@edk-linux edk]# /usr/sbin/exportfs
> 
> /tmp            10.0.0.123/32
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ________________________________________
> 
> From: Kwan, Ed
> 
> Sent: Wednesday, March 03, 2010 5:36 AM
> 
> To: Shedage, Pravin
> 
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian; Sharp, Andy
> 
> Subject: RE: Please review the code regarding defect TED00028036.
> 
> 
> 
> Adding Andy since he's the "Lead" for the "SW-CLI" area per
> ClearQuest.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> There's already a pre-defined type boolean, TRUE, FALSE, so I don't
> you need to create your own "False" and "True":
> 
> 
> 
> 78,82d77
> 
> 
> 
> < #define False          0
> 
> 
> 
> < #define True           1
> 
> 
> 
> 
> 
> 
> 
> I believe this assumption is wrong:
> 
> 
> 
> <     /* Ipaddress should not start with '.'
> 
> 
> 
> <        '*' not present in Ipaddr, then there should be 3 '.' */
> 
> 
> 
> <     if (('.' == *szIpaddr) ||
> 
> 
> 
> <             ((NULL == strchr(szIpaddr, '*')) && (3 != temp_token)))
> {
> 
> 
> 
> <         return False;
> 
> 
> 
> <     }
> 
> 
> 
> 3 '.' are not required; see the inet_addr(3p) man page.
> 
> 
> 
> I don't think there's a problem with inet_aton(), and that's what you
> should use.
> 
> 
> 
> 
> 
> 
> 
> Also look at
> 
> 
> 
> http://wiki.onstor.net/wiki/ONStor_Coding_Style_Guide
> 
> 
> 
> as your comments are not in the standard style such as:
> 
> 
> 
> /*
> 
> 
> 
>  * Comment here.
> 
> 
> 
>  */
> 
> 
> 
> 
> 
> 
> 
> What are "saveptr1" and "saveptr2"?  Are they the ip address and
> mask? Can you use more descriptive names?
> 
> 
> 
> <     if (NULL != strchr(str1, '/')) {
> 
> 
> 
> <         token = strtok_r(str1, "", &saveptr1);
> 
> 
> 
> 
> 
> 
> 
> Maybe fprintf(stderr, ...) for internal errors?
> 
> 
> 
> <     if (NULL == str1) {
> 
> 
> 
> <         printf("%s:%d Memory Allocate Error \n", __FILE__,
> __LINE__);
> 
> 
> 
> 
> 
> 
> 
> Should use True or TRUE instead of "1":
> 
> 
> 
> 577,579c369,372
> 
> 
> 
> <         if (1 == isValidIpaddr(buff)) {
> 
> 
> 
> <               return(ip.s_addr);
> 
> 
> 
> <         }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> 
> From: Shedage, Pravin
> 
> Sent: Tuesday, March 02, 2010 2:16 AM
> 
> To: Kwan, Ed
> 
> Cc: Agarwal, Anurag; Sawant, Yogesh; Nguyen, Brian
> 
> Subject: Please review the code regarding defect TED00028036.
> 
> 
> 
> 
> 
> 
> 
> Hi Ed,
> 
> 
> 
>          Please review the code regarding defect TED00028036.
> 
> 
> 
> 
> 
> 
> 
> Problem:  nfs share modify: doesn't check for valid IP for client list
> 
> 
> 
> 
> 
> 
> 
> I added 3 new functions in file
> 
> 
> 
>       /homes/pshedage/pravin/dev/nfx-tree/code/ssc-nfxsh/cmd_nfs.c
> 
> 
> 
> 
> 
> 
> 
> int countCharInString(char *szSource, char ch);
> 
> 
> 
> int isNumber(char *szNumber);
> 
> 
> 
> int isValidIpaddr(char *szIpaddr);
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 1) steps to check newly added code
> 
> 
> 
>     1) P4CLIENT=pravin
> 
> 
> 
>     2) export P4DIFF=
> 
> 
> 
>     3) p4 diff to see the differences.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Need:
> 
> 
> 
>        There is problem in inet_aton() function which does not check
> for validation of ip address.
> 
> 
> 
> Please try following cases:
> 
> 
> 
> 
> 
> 
> 
> 1.
> 
> 
> 
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
> 
> 
> 
> rw=10.3.15.12
> 
> 
> 
> no_root_squash=*
> 
> 
> 
> 
> 
> 
> 
> 2.
> 
> 
> 
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
> 
> 
> 
> rw=12.912
> 
> 
> 
> no_root_squash=c12r15-rhel4.onstor.lab
> 
> 
> 
> 
> 
> 
> 
> 3.
> 
> 
> 
> g7r203 TEST diag> nfs share modify /Vol_g7r203_test
> 
> 
> 
> rw=*
> 
> 
> 
> no_root_squash=c12r15-rhel4.onstor.lab
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Used Machine for work:
> 
> 
> 
> 
> 
> 
> 
> Getway:   10.2.6.5
> 
> 
> 
> Client:   10.2.15.12
> 
> 
> 
> compileS: 10.0.0.23
> 
> 
