Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: fix potential overflow when cnovert ip to value #464

Merged

Conversation

wu-hanqing
Copy link
Contributor

@wu-hanqing wu-hanqing commented Jul 22, 2021

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@@ -21,6 +21,18 @@ daemonLog=${logPath}/curve-mds-daemon.log
# console output
consoleLog=${logPath}/curve-mds-console.log

function ip_value() {
ip=$(echo $1 | awk -F':' '{ printf $1 }')
Copy link
Contributor

@Wine93 Wine93 Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the function can be more simple:

echo $1 | awk -F '[:/.]' '{ 
    mask = (2 ** 8) 
    print (($1 * mask + $2)  * mask + $3) * mask + $4 
}'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@wu-hanqing wu-hanqing force-pushed the scripts/fix-ip-calc-overflow branch from 4cda478 to 6ba0a3c Compare July 23, 2021 02:32
@wu-hanqing wu-hanqing force-pushed the scripts/fix-ip-calc-overflow branch from 6ba0a3c to 7af8a32 Compare July 23, 2021 02:54
@ilixiaocui ilixiaocui merged commit 01a6689 into opencurve:master Jul 28, 2021
@wu-hanqing wu-hanqing deleted the scripts/fix-ip-calc-overflow branch August 6, 2021 16:12
ilixiaocui pushed a commit to ilixiaocui/curve that referenced this pull request Feb 6, 2023
Add KubeEdge to LFX Mentorship Q1-2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants