[SERVER-14806] localhostAuthBypass jstest can fail for specific ifconfig outputs Created: 06/Aug/14  Updated: 11/Jul/16  Resolved: 15/Aug/14

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 2.7.5

Type: Bug Priority: Minor - P4
Reporter: Spencer Jackson Assignee: Spencer Jackson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OpenSUSE 13.1 x86_64


Issue Links:
Related
is related to SERVER-14652 Update tests for localhost exception Closed
Operating System: Linux
Steps To Reproduce:

1) Use OpenSUSE 13.1
2) Run jstests/auth/localhostAuthBypass.js with smoke.py

Participants:

 Description   

The localhostAuthBypass test uses the get_ipaddr method from jstests/libs/host_ipaddr.js to obtain the host's ipv4 address. get_ipaddr works on Unix systems by calling /sbin/ifconfig and performing some text processing on the output. An example of this output is as follows:

inet addr:10.4.102.211 Bcast:10.4.255.255 Mask:255.255.0.0

get_ipaddr greps for all ifconfig lines containing the string "inet", filters out all lines containing "127.0.0.1" and then removes the first occurrence of the string "addr:". The address is found using a regular expression which returns all characters after the string "inet " until whitespace is encountered.

This process can fail if ifconfig returns a result which, when grepped, looks like:

inet6 addr: ::1/128 Scope:Host
inet addr:10.4.102.211 Bcast:10.4.255.255 Mask:255.255.0.0
inet6 addr: fe80::3e15:c2ff:fedc:4994/64 Scope:Link

When ifconfig returns an IPv6 address before an IPv4 address the "addr:" string will be removed from the leading IPv6 entry, which is subsequently ignored by the regular expression. This results in get_ipaddr returning an IPv4 address prefixed by "addr:", which is invalid.



 Comments   
Comment by Githook User [ 12/Aug/14 ]

Author:

{u'name': u'Spencer Jackson', u'email': u'spencer.jackson@mongodb.com'}

Message: SERVER-14806: Improve get_ipaddr parsing in JS tests

Closes #741

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/d07bd48ce773907d04a63bcedcc9e69283391a09

Generated at Thu Feb 08 03:36:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.