Skip to content

Commit

Permalink
Quick fix for [ character in prod.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Engin Eren committed May 10, 2016
1 parent 3e8a77e commit cf3077b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Federation/create_allow-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ fi

#cat $FEDINFO/in/prod.txt | cut -d : -f1 | sort -u | awk -F. '{if ($NF == "uk" || $NF == "fr" || $NF == "it" || $(NF-1) == "cern" ) print $(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-1) == "vanderbilt" ) print $(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-1) == "mit" ) print $(NF-2)"."$(NF-1)"."$NF; else print $(NF-1)"."$NF}' | sort -u > $FEDINFO/in/prod_domain.txt

#Quick fix for "[" character in prod.txt
cat $FEDINFO/in/prod.txt | awk '{ if ($1 == "[") print "Unknown.Host"; else print $1;}' > $FEDINFO/in/tmp
cp $FEDINFO/in/tmp $FEDINFO/in/prod.txt
rm $FEDINFO/in/tmp



cat $FEDINFO/in/prod.txt | sort -u | awk -F. '{if ($NF == "uk" && $(NF-2) != "rl" || $NF == "fr" || $(NF-1) == "cern" || $(NF-1) == "fnal" ) print $(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-2) == "cnaf") print $(NF-4)"."$(NF-2); else if ( $NF == "it" && $(NF-2) != "cnaf" ) print $(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-1) == "vanderbilt" ) print $(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-1) == "mit" ) print $(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-2) == "rl" ) print $(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else if ( $NF == "kr") print $(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else if ( $NF == "be" ) print $(NF-2)"."$(NF-1)"."$NF; else print $(NF-1)"."$NF}' | sort -u > $FEDINFO/in/prod_domain.txt

cat $FEDINFO/in/trans.txt | cut -d : -f1 | sort -u | awk -F. '{if ($NF == "uk" || $NF == "fr" || $NF == "kr" ) print $(NF-2)"."$(NF-1)"."$NF; else if ($NF == "it" && $(NF-2) == "cnaf" ) print $(NF-4)"."$(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else if ( $(NF-2) == "ts" ) print $(NF-3)"."$(NF-2)"."$(NF-1)"."$NF; else print $(NF-1)"."$NF}' | sort -u > $FEDINFO/in/trans_domain.txt
Expand Down

4 comments on commit cf3077b

@zvada
Copy link
Contributor

@zvada zvada commented on cf3077b May 11, 2016

Choose a reason for hiding this comment

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

Even for a quick fix, would be better make it nicer than search for "[". This should make it solution for good I believe:

#!/bin/sh

if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
  echo IPv4
elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then
  echo IPv6
else
  echo "Unrecognized IP format '$1'"
fi

Could you incorporate this kind of regexp into your code? Or something along that example should do it...

@EnginEren
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Marian,
Before implementing, I would like to understand.. If you look at here :

xrdmapc --list all cms-xrd-transit.cern.ch:1094

0**** cms-xrd-transit.cern.ch:1094
...... .....
Srv [::ffff:136.145.164.182]:1094
............
Srv lyogrid06.in2p3.fr:11001

Your example code tells me that this strange hostname (::ffff:136.145.164.182) is ipv4. Yes, it makes sense but

  1. Why do we have "ugly" thing ::ffff ??
  2. Shouldnt we have a "proper hostname" like lyogrid06.in2p3.fr?

@zvada
Copy link
Contributor

@zvada zvada commented on cf3077b Jul 15, 2016

Choose a reason for hiding this comment

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

Sorry for late answer:

  1. Strange-looking identifier: well, this comes from network designers, we can't do much about it other than deal with it
  2. That depends on DNS reverse look up. Some sites may have dual-stack hosts configured, but improperly (or not) registered in their DNS under AAAA records. Since all of this is sort of new to everyone, some site admins configure it well and we get proper hostname or simply we get strange-looking network identifier. Reverse lookup should fix this and whenever we find someting like this we can contact site admins to fix it.

-Marian

@zvada
Copy link
Contributor

@zvada zvada commented on cf3077b Jul 18, 2017

Choose a reason for hiding this comment

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

Has this been understood and implemented properly, @EnginEren? Have you tested we can recognize IPv6 vs IPv4 entries and parse accordingly? Just trying to see what issues are still pending and which one we can close as resolved... Thanks.

Please sign in to comment.