[Serusers] Some patches for integration [actual patches]

Claudio Thorell dos Santos cthorell at telenova.net
Fri Jan 10 13:33:01 CET 2003


That's what I was trying to do, thanks a lot.

Claudio

----- Original Message -----
From: "Jiri Kuthan" <jiri at iptel.org>
To: "Maxim Sobolev" <sobomax at freebsd.org>; <serusers at lists.iptel.org>;
<kapitan at portaone.com>
Sent: Thursday, January 09, 2003 10:24 PM
Subject: Re: [Serusers] Some patches for integration [actual patches]


> Maxim,
>
> thank you very much for the patches. We will review them as soon
> as our developers resync -- part of us is still on vacation, the
> other part will be travelling to a SIP conference next week.
>
> Cheers,
>
> -Jiri
>
> At 04:36 PM 1/9/2003, Maxim Sobolev wrote:
> >Forgot to mention that those patches also slightly change install target,
> >so that it doesn't rewrite old (and probably customised) version if it
> >exists.
> >
> >-Maxim
> >
> >On Wed, Jan 08, 2003 at 11:08:35PM +0200, Maxim Sobolev wrote:
> >> OOPS, forgot to attach the patch. Doing it now.
> >>
> >> -Maxim
> >>
> >> On Wed, Jan 08, 2003 at 11:02:29PM +0200, Maxim Sobolev wrote:
> >> > Folks,
> >> >
> >> > Attached please find several patches for ser 0.8.10. They do the
following:
> >> >
> >> > 1. Removes hardcoded `/usr/local' from Makefiles and replaces it with
> >> > LOCALBASE variable setable in the top Makefile.defs. This should make
> >> > life of packagers easier.
> >> >
> >> > 2. Allows to override PREFIX variable with something else from
environment.
> >> >
> >> > 3. Adds support for FreeBSD doc/man directories layout.
> >> >
> >> > 4. Adds some missed -I's into radius modules.
> >> >
> >> > 5. Fixes radius modules to use the same symbolic avp names as in
dictionary.
> >> >
> >> > 6. Adds support for recording source port in msg structure and adds
it
> >> > in "Noisy feedback". This should be extremely useful for debugging
various
> >> > SIP&NAT scenarios and later could be re-used to implement `rport'
support
> >> > described in my previous message.
> >> >
> >> > It would be nice to have those patches integrated into the next
release.
> >> >
> >> > Thanks!
> >> >
> >> > -Maxim
> >> > _______________________________________________
> >> > Serusers mailing list
> >> > serusers at lists.iptel.org
> >> > http://lists.iptel.org/mailman/listinfo/serusers
> >
> >> --- modules/jabber/Makefile.orig      Mon Nov 11 23:34:53 2002
> >> +++ modules/jabber/Makefile   Wed Jan  8 22:39:46 2003
> >> @@ -8,7 +8,7 @@
> >>  auto_gen=
> >>  NAME=jabber.so
> >>  # expat.h location
> >> -DEFS+=-I/usr/local/include
> >> -LIBS=-L/usr/local/lib -lexpat
> >> +DEFS+=-I$(LOCALBASE)/include
> >> +LIBS=-L$(LOCALBASE)/lib -lexpat
> >>
> >>  include ../../Makefile.modules
> >> --- modules/mysql/Makefile.orig       Tue Nov 12 14:32:17 2002
> >> +++ modules/mysql/Makefile    Wed Jan  8 22:39:46 2003
> >> @@ -5,11 +5,12 @@
> >>  auto_gen=
> >>  NAME=mysql.so
> >>  # mysql.h locations (freebsd,openbsd  solaris)
> >> -DEFS +=-I/usr/local/include -I/usr/local/mysql/include \
> >> +DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/mysql \
> >> +             -I$(LOCALBASE)/mysql/include
> >>  # libmysqlclient locations on RH/Suse, Solaris /OpenBSD, FreeBSD
> >>  # (Debian does the right thing and puts it in /usr/lib)
> >> -LIBS=-L/usr/lib/mysql -L /usr/local/lib -L/usr/local/lib/mysql \
> >> -             -L/usr/local/mysql/lib/mysql/ \
> >> +LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \
> >> +             -L$(LOCALBASE)/mysql/lib/mysql/ \
> >>               -lmysqlclient -lz
> >>
> >>  include ../../Makefile.modules
> >> --- modules/radius_acc/Makefile.orig  Thu Aug  8 20:28:55 2002
> >> +++ modules/radius_acc/Makefile       Wed Jan  8 22:39:46 2003
> >> @@ -6,7 +6,8 @@
> >>
> >>  auto_gen=
> >>  NAME=radius_acc.so
> >> -LIBS=-L/usr/local/lib -lradiusclient
> >> +DEFS += -I$(LOCALBASE)/include
> >> +LIBS=-L$(LOCALBASE)/lib -lradiusclient
> >>
> >>
> >>  include ../../Makefile.modules
> >> --- modules/radius_acc/acc.c.orig     Thu Sep 19 15:23:54 2002
> >> +++ modules/radius_acc/acc.c  Wed Jan  8 22:39:46 2003
> >> @@ -285,9 +285,9 @@
> >>      else
> >>       tmp = cleanbody(rq->first_line.u.request.uri);
> >>
> >> -     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQ_URI,
> >> +     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQUEST_URI,
> >>                                               tmp, 0) == NULL) {
> >> -             DBG("radius_log_reply(): ERROR:PW_SIP_TRANSLATED_REQ_URI
\n");
> >> +             DBG("radius_log_reply():
ERROR:PW_SIP_TRANSLATED_REQUEST_URI \n");
> >>               return(ERROR_RC);
> >>       }
> >>
> >> @@ -585,9 +585,9 @@
> >>       tmp = cleanbody(msg->first_line.u.request.uri);
> >>
> >>       tmp = cleanbody(msg->new_uri);
> >> -     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQ_URI,
> >> +     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQUEST_URI,
> >>                                                       tmp, 0) == NULL)
{
> >> -             DBG("radius_log_ack(): ERROR:PW_SIP_TRANSLATED_REQ_URI
\n");
> >> +             DBG("radius_log_ack():
ERROR:PW_SIP_TRANSLATED_REQUEST_URI \n");
> >>               return(ERROR_RC);
> >>       }
> >>
> >> @@ -901,9 +901,9 @@
> >>      else
> >>       tmp = cleanbody(rq->first_line.u.request.uri);
> >>
> >> -     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQ_URI,
> >> +     if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQUEST_URI,
> >>                                               tmp, 0) == NULL) {
> >> -             DBG("rad_acc_request(): ERROR:PW_SIP_TRANSLATED_REQ_URI
\n");
> >> +             DBG("rad_acc_request():
ERROR:PW_SIP_TRANSLATED_REQUEST_URI \n");
> >>               return(ERROR_RC);
> >>       }
> >>
> >> --- modules/radius_auth/Makefile.orig Tue Sep  3 17:08:41 2002
> >> +++ modules/radius_auth/Makefile      Wed Jan  8 22:39:46 2003
> >> @@ -7,6 +7,7 @@
> >>
> >>  auto_gen=
> >>  NAME=radius_auth.so
> >> -LIBS=-L/usr/local/lib -lradiusclient
> >> +DEFS += -I$(LOCALBASE)/include
> >> +LIBS=-L$(LOCALBASE)/lib -lradiusclient
> >>
> >>  include ../../Makefile.modules
> >> --- modules/radius_auth/digest.c.orig Thu Sep 19 15:23:54 2002
> >> +++ modules/radius_auth/digest.c      Wed Jan  8 22:39:46 2003
> >> @@ -75,11 +75,11 @@
> >>                                               cleanbody(cred->realm),
0) == NULL)
> >>          return (ERROR_RC);
> >>
> >> -     if (rc_avpair_add(&send, PW_SIP_NONCE,
> >> +     if (rc_avpair_add(&send, PW_SIP_USER_NONCE,
> >>                                               cleanbody(cred->nonce),
0) == NULL)
> >>          return (ERROR_RC);
> >>
> >> -     if (rc_avpair_add(&send, PW_SIP_NONCE_COUNT,
> >> +     if (rc_avpair_add(&send, PW_SIP_USER_NONCE_COUNT,
> >>                                               cleanbody(cred->nc), 0)
== NULL)
> >>          return (ERROR_RC);
> >>
> >> --- modules/snmp/Makefile.orig        Thu Aug 29 23:13:52 2002
> >> +++ modules/snmp/Makefile     Wed Jan  8 22:39:46 2003
> >> @@ -13,5 +13,5 @@
> >>  # The way it should be:
> >>  # CFLAGS += `net-snmp-config --cflags`
> >>  #
> >> -CFLAGS += -I/usr/local/include
> >> +CFLAGS += -I$(LOCALBASE)/include
> >>  LIBS+=`net-snmp-config --agent-libs`
> >> --- parser/msg_parser.h.orig  Wed Oct 23 18:12:20 2002
> >> +++ parser/msg_parser.h       Wed Jan  8 22:39:46 2003
> >> @@ -118,7 +118,9 @@
> >>       char* unparsed;   /* here we stopped parsing*/
> >>
> >>       struct ip_addr src_ip;
> >> +     unsigned short src_port_no;
> >>       struct ip_addr dst_ip;
> >> +     unsigned short dst_port_no;
> >>
> >>       char* orig;       /* original message copy */
> >>       char* buf;        /* scratch pad, holds a modfied message,
> >> --- Makefile.orig     Tue Nov 12 14:31:25 2002
> >> +++ Makefile  Wed Jan  8 22:48:09 2003
> >> @@ -158,8 +158,12 @@
> >>
> >>  install-cfg: $(cfg-prefix)/$(cfg-dir)
> >>               sed -e "s#/usr/lib/ser/modules/#$(modules-target)#g" \
> >> -                     < etc/ser.cfg > $(cfg-prefix)/$(cfg-dir)ser.cfg
> >> -             chmod 644 $(cfg-prefix)/$(cfg-dir)ser.cfg
> >> +                     < etc/ser.cfg >
$(cfg-prefix)/$(cfg-dir)ser.cfg.default
> >> +             chmod 644 $(cfg-prefix)/$(cfg-dir)ser.cfg.default
> >> +             if [ ! -e $(cfg-prefix)/$(cfg-dir)ser.cfg ]; then \
> >> +                     cp -p $(cfg-prefix)/$(cfg-dir)ser.cfg.default \
> >> +                             $(cfg-prefix)/$(cfg-dir)ser.cfg; \
> >> +             fi
> >>  #            $(INSTALL-CFG) etc/ser.cfg $(cfg-prefix)/$(cfg-dir)
> >>
> >>  install-bin: $(bin-prefix)/$(bin-dir) utils/gen_ha1/gen_ha1
> >> --- Makefile.defs.orig        Tue Nov 12 19:21:28 2002
> >> +++ Makefile.defs     Wed Jan  8 22:39:45 2003
> >> @@ -16,7 +16,8 @@
> >>                       -e s/armv4l/arm/)
> >>
> >>   # install location
> >> -PREFIX = /usr/local
> >> +PREFIX ?= /usr/local
> >> +LOCALBASE ?= /usr/local
> >>  prefix = $(PREFIX)
> >>  # install path is $(basedir) $(prefix)
> >>  # example:
> >> @@ -40,9 +41,14 @@
> >>       doc-dir = share/doc/ser/
> >>       man-dir = share/man/
> >>  else
> >> +ifeq ($(OS), freebsd)
> >> +     doc-dir = share/doc/ser/
> >> +     man-dir = man/
> >> +else
> >>       doc-dir=doc/ser/
> >>       man-dir=man/
> >>  endif
> >> +endif
> >>  ut-prefix = bin/
> >>  # target dirs for various stuff
> >>  cfg-target = $(prefix)/$(cfg-dir)
> >> --- ip_addr.h.orig    Mon Nov  4 19:05:32 2002
> >> +++ ip_addr.h Wed Jan  8 22:39:46 2003
> >> @@ -201,6 +201,21 @@
> >>       }
> >>  }
> >>
> >> +static inline unsigned int su2port_no(union sockaddr_union* su)
> >> +{
> >> +     switch(su->s.sa_family){
> >> +     case AF_INET:
> >> +                                     return su->sin.sin_port;
> >> +#ifdef USE_IPV6
> >> +     case AF_INET6:
> >> +                                     return su->sin6.sin6_port;
> >> +#endif
> >> +     default:
> >> +                                     LOG(L_CRIT,"su2port_no: BUG:
unknown address family %d\n",
> >> +                                                     su->s.sa_family);

> >> +     }
> >> +     return 0;
> >> +}
> >>
> >>  /* ip_addr2su -> the same as init_su*/
> >>  #define ip_addr2su init_su
> >> --- msg_translator.c.orig     Mon Oct 21 22:21:50 2002
> >> +++ msg_translator.c  Wed Jan  8 22:39:46 2003
> >> @@ -145,9 +145,10 @@
> >>       else
> >>               foo=&(msg->first_line.u.request.uri);
> >>       print_len=snprintf(buf+fix_len, MAX_WARNING_LEN-fix_len,
> >> -             "pid=%d req_src_ip=%s in_uri=%.*s out_uri=%.*s
via_cnt%c=%d\"",
> >> +             "pid=%d req_src_ip=%s req_src_port=%d in_uri=%.*s
out_uri=%.*s via_cnt%c=%d\"",
> >>               my_pid(),
> >>               ip_addr2a(&msg->src_ip),
> >> +             msg->src_port_no,
> >>               msg->first_line.u.request.uri.len,
msg->first_line.u.request.uri.s,
> >>               foo->len, foo->s,
> >>               msg->parsed_flag & HDR_EOH ? '=' : '>', /* should be = */
> >> --- receive.c.orig    Thu Oct  3 23:06:10 2002
> >> +++ receive.c Wed Jan  8 22:39:46 2003
> >> @@ -77,6 +77,7 @@
> >>          useful as most of the work is done with scrath-pad; -jiri  */
> >>       buf[len]=0;
> >>       su2ip_addr(&msg->src_ip, src_su);
> >> +     msg->src_port_no=su2port_no(src_su);
> >>       msg->dst_ip=bind_address->address; /* won't work if listening on
0.0.0.0 */
> >>       msg->id=msg_no;
> >>       /* make a copy of the message */
> >
> >_______________________________________________
> >Serusers mailing list
> >serusers at lists.iptel.org
> >http://lists.iptel.org/mailman/listinfo/serusers
>
> --
> Jiri Kuthan            http://iptel.org/~jiri/
>
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>




More information about the sr-users mailing list